kcl-lang.io/kpm@v0.8.7-0.20240520061008-9fc4c5efc8c7/test/e2e/e2e_suite_test.go (about)

     1  package e2e
     2  
     3  import (
     4  	"fmt"
     5  	"path/filepath"
     6  	"testing"
     7  
     8  	"github.com/onsi/ginkgo/v2"
     9  	"github.com/onsi/gomega"
    10  )
    11  
    12  func TestE2e(t *testing.T) {
    13  	gomega.RegisterFailHandler(ginkgo.Fail)
    14  	ginkgo.RunSpecs(t, "E2e Suite")
    15  }
    16  
    17  var _ = ginkgo.BeforeEach(func() {
    18  	ginkgo.By("create kpm test workspace", func() {
    19  		_ = CreateTestWorkspace()
    20  	})
    21  })
    22  
    23  var _ = ginkgo.AfterEach(func() {
    24  	ginkgo.By("clean up kpm test workspace", func() {
    25  		_ = CleanUpTestWorkspace()
    26  	})
    27  })
    28  
    29  var _ = ginkgo.AfterSuite(func() {
    30  	ginkgo.By("clean up kpm bin", func() {
    31  		path := filepath.Join(GetWorkDir(), "../..", "bin")
    32  		cli := fmt.Sprintf("rm -rf %s", path)
    33  		stdout, stderr, err := Exec(cli)
    34  		gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
    35  		gomega.Expect(stdout).To(gomega.BeEmpty())
    36  		gomega.Expect(stderr).To(gomega.BeEmpty())
    37  	})
    38  })