Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Suites that only import the new dsl packages are correctly identified…
… as Ginkgo suites

resolves #891
  • Loading branch information
onsi committed Jan 27, 2022
1 parent 2b99589 commit ec17e17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ginkgo/internal/test_suite.go
Expand Up @@ -268,7 +268,7 @@ func packageNameForSuite(dir string) string {

func filesHaveGinkgoSuite(dir string, files []os.DirEntry) bool {
reTestFile := regexp.MustCompile(`_test\.go$`)
reGinkgo := regexp.MustCompile(`package ginkgo|\/ginkgo"|\/ginkgo\/v2"`)
reGinkgo := regexp.MustCompile(`package ginkgo|\/ginkgo"|\/ginkgo\/v2"|\/ginkgo\/v2/dsl/`)

for _, file := range files {
if !file.IsDir() && reTestFile.Match([]byte(file.Name())) {
Expand Down
8 changes: 8 additions & 0 deletions ginkgo/internal/testsuite_test.go
Expand Up @@ -76,6 +76,9 @@ var _ = Describe("TestSuite", func() {
//ginkgo tests in a deeply nested directory
writeFile("/colonelmustard/library", "library_test.go", `import "github.com/onsi/ginkgo/v2"`, 0666)

//ginkgo tests in a deeply nested directory
writeFile("/colonelmustard/library/spanner", "spanner_test.go", `import "github.com/onsi/ginkgo/v2/dsl/core"`, 0666)

//ginkgo tests deeply nested in a vendored dependency
writeFile("/vendor/mrspeacock/lounge", "lounge_test.go", `import "github.com/onsi/ginkgo/v2"`, 0666)

Expand Down Expand Up @@ -104,6 +107,7 @@ var _ = Describe("TestSuite", func() {
TS("./professorplum", "professorplum", false, TestSuiteStateUncompiled),
TS("./colonelmustard", "colonelmustard", true, TestSuiteStateUncompiled),
TS("./colonelmustard/library", "library", true, TestSuiteStateUncompiled),
TS("./colonelmustard/library/spanner", "spanner", true, TestSuiteStateUncompiled),
))
})
})
Expand All @@ -120,6 +124,7 @@ var _ = Describe("TestSuite", func() {
TS("./professorplum", "professorplum", false, TestSuiteStateSkippedByFilter),
TS("./colonelmustard", "colonelmustard", true, TestSuiteStateUncompiled),
TS("./colonelmustard/library", "library", true, TestSuiteStateSkippedByFilter),
TS("./colonelmustard/library/spanner", "spanner", true, TestSuiteStateSkippedByFilter),
))
})
})
Expand Down Expand Up @@ -160,6 +165,7 @@ var _ = Describe("TestSuite", func() {
Ω(suites).Should(ConsistOf(
TS("./colonelmustard", "colonelmustard", true, TestSuiteStateUncompiled),
TS("./colonelmustard/library", "library", true, TestSuiteStateUncompiled),
TS("./colonelmustard/library/spanner", "spanner", true, TestSuiteStateUncompiled),
))
})
})
Expand All @@ -176,6 +182,7 @@ var _ = Describe("TestSuite", func() {
TS("./professorplum", "professorplum", false, TestSuiteStateUncompiled),
TS("./colonelmustard", "colonelmustard", true, TestSuiteStateUncompiled),
TS("./colonelmustard/library", "library", true, TestSuiteStateSkippedByFilter),
TS("./colonelmustard/library/spanner", "spanner", true, TestSuiteStateSkippedByFilter),
))
})
})
Expand Down Expand Up @@ -205,6 +212,7 @@ var _ = Describe("TestSuite", func() {
TS("./professorplum", "professorplum", false, TestSuiteStateUncompiled),
TS("./colonelmustard", "colonelmustard", true, TestSuiteStateUncompiled),
TS("./colonelmustard/library", "library", true, TestSuiteStateUncompiled),
TS("./colonelmustard/library/spanner", "spanner", true, TestSuiteStateUncompiled),
))
})
})
Expand Down

0 comments on commit ec17e17

Please sign in to comment.