Skip to content

Commit

Permalink
Inoke reporting nodes during dry-run (fixes #956 and #935)
Browse files Browse the repository at this point in the history
  • Loading branch information
onsi committed Mar 31, 2022
1 parent 23bc755 commit aae4480
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
13 changes: 10 additions & 3 deletions internal/internal_integration/config_dry_run_test.go
Expand Up @@ -20,7 +20,7 @@ var _ = Describe("when config.DryRun is enabled", func() {
It("B", rt.T("B", func() { F() }))
PIt("C", rt.T("C", func() { F() }))
It("D", rt.T("D"))
It("E", rt.T("D"))
It("E", rt.T("E"))
})
AfterEach(rt.T("aft"))
AfterSuite(rt.T("after-suite"))
Expand All @@ -29,8 +29,15 @@ var _ = Describe("when config.DryRun is enabled", func() {
})
})

It("does not run any tests", func() {
Ω(rt).Should(HaveTrackedNothing())
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() {
Expand Down
6 changes: 4 additions & 2 deletions internal/report_entry_test.go
Expand Up @@ -266,7 +266,8 @@ var _ = Describe("ReportEntry and ReportEntries", func() {
})

ReportAfterEach(func(report SpecReport) {
if report.State.Is(types.SpecStatePassed) {
config, _ := GinkgoConfiguration()
if !config.DryRun && report.State.Is(types.SpecStatePassed) {
Ω(report.ReportEntries[0].StringRepresentation()).Should(Equal("{{red}}bob {{green}}17{{/}}"))
}
})
Expand All @@ -289,7 +290,8 @@ var _ = Describe("ReportEntry and ReportEntries", func() {
})

ReportAfterEach(func(report SpecReport) {
if report.State.Is(types.SpecStatePassed) {
config, _ := GinkgoConfiguration()
if !config.DryRun && report.State.Is(types.SpecStatePassed) {
Ω(report.ReportEntries[0].StringRepresentation()).Should(Equal("{{red}}alice {{green}}42{{/}}"))
}
})
Expand Down
9 changes: 0 additions & 9 deletions internal/suite.go
Expand Up @@ -393,10 +393,6 @@ func (suite *Suite) runReportAfterSuite() {
}

func (suite *Suite) reportEach(spec Spec, nodeType types.NodeType) {
if suite.config.DryRun {
return
}

nodes := spec.Nodes.WithType(nodeType)
if nodeType == types.NodeTypeReportAfterEach {
nodes = nodes.SortedByDescendingNestingLevel()
Expand Down Expand Up @@ -525,11 +521,6 @@ func (suite *Suite) runSuiteNode(node Node, interruptChannel chan interface{}) {
}

func (suite *Suite) runReportAfterSuiteNode(node Node, report types.Report) {
if suite.config.DryRun {
suite.currentSpecReport.State = types.SpecStatePassed
return
}

suite.writer.Truncate()
suite.outputInterceptor.StartInterceptingOutput()
suite.currentSpecReport.StartTime = time.Now()
Expand Down

0 comments on commit aae4480

Please sign in to comment.