/
config_dry_run_test.go
59 lines (52 loc) · 1.99 KB
/
config_dry_run_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package internal_integration_test
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/ginkgo/v2/internal/test_helpers"
. "github.com/onsi/gomega"
)
var _ = Describe("when config.DryRun is enabled", func() {
BeforeEach(func() {
conf.DryRun = true
conf.SkipStrings = []string{"E"}
RunFixture("dry run", func() {
BeforeSuite(rt.T("before-suite"))
BeforeEach(rt.T("bef"))
ReportBeforeEach(func(_ SpecReport) { rt.Run("report-before-each") })
Describe("container", func() {
It("A", rt.T("A"))
It("B", rt.T("B", func() { F() }))
PIt("C", rt.T("C", func() { F() }))
It("D", rt.T("D"))
It("E", rt.T("E"))
})
AfterEach(rt.T("aft"))
AfterSuite(rt.T("after-suite"))
ReportAfterEach(func(_ SpecReport) { rt.Run("report-after-each") })
ReportAfterSuite("", func(_ Report) { rt.Run("report-after-suite") })
})
})
It("does not run any tests but does invoke reporters", func() {
Ω(rt).Should(HaveTracked(
"report-before-each", "report-after-each", //A
"report-before-each", "report-after-each", //B
"report-before-each", "report-after-each", //C
"report-before-each", "report-after-each", //D
"report-before-each", "report-after-each", //E
"report-after-suite", //AfterSuite
))
})
It("reports on the tests (both that they will run and that they did run) and honors skip state", func() {
Ω(reporter.Will.Names()).Should(Equal([]string{"A", "B", "C", "D", "E"}))
Ω(reporter.Will.Find("C")).Should(BePending())
Ω(reporter.Will.Find("E")).Should(HaveBeenSkipped())
Ω(reporter.Did.Names()).Should(Equal([]string{"A", "B", "C", "D", "E"}))
Ω(reporter.Did.Find("A")).Should(HavePassed())
Ω(reporter.Did.Find("B")).Should(HavePassed())
Ω(reporter.Did.Find("C")).Should(BePending())
Ω(reporter.Did.Find("D")).Should(HavePassed())
Ω(reporter.Did.Find("E")).Should(HaveBeenSkipped())
})
It("reports the correct statistics", func() {
Ω(reporter.End).Should(BeASuiteSummary(NSpecs(5), NPassed(3), NPending(1), NSkipped(1)))
})
})