Skip to content

Commit 5cf23e2

Browse files
committed
Always emit spec summary
in V2 the spec summary behavior was changed such that the summary was only shown if there was more than one failure. This breaks scrapers that rely on more consistent console output to analyze the test results. With this commit, Ginkgo will always emit the summary. Fixed #973
1 parent 3cd8b93 commit 5cf23e2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

reporters/default_reporter.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,13 @@ func (r *DefaultReporter) DidRun(report types.SpecReport) {
251251

252252
func (r *DefaultReporter) SuiteDidEnd(report types.Report) {
253253
failures := report.SpecReports.WithState(types.SpecStateFailureStates)
254-
if len(failures) > 1 {
254+
if len(failures) > 0 {
255255
r.emitBlock("\n\n")
256-
r.emitBlock(r.f("{{red}}{{bold}}Summarizing %d Failures:{{/}}", len(failures)))
256+
if len(failures) > 1 {
257+
r.emitBlock(r.f("{{red}}{{bold}}Summarizing %d Failures:{{/}}", len(failures)))
258+
} else {
259+
r.emitBlock(r.f("{{red}}{{bold}}Summarizing 1 Failure:{{/}}"))
260+
}
257261
for _, specReport := range failures {
258262
highlightColor, heading := "{{red}}", "[FAIL]"
259263
switch specReport.State {

reporters/default_reporter_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,11 @@ var _ = Describe("DefaultReporter", func() {
11351135
},
11361136
},
11371137
"",
1138+
"",
1139+
"{{red}}{{bold}}Summarizing 1 Failure:{{/}}",
1140+
" {{red}}[FAIL]{{/}} {{/}}Describe A {{gray}}{{red}}{{bold}}Context B [JustBeforeEach]{{/}} {{/}}The Test{{/}}",
1141+
" {{gray}}cl4.go:144{{/}}",
1142+
"",
11381143
"{{red}}{{bold}}Ran 6 of 11 Specs in 60.000 seconds{{/}}",
11391144
"{{red}}{{bold}}FAIL!{{/}} -- {{green}}{{bold}}5 Passed{{/}} | {{red}}{{bold}}1 Failed{{/}} | {{light-yellow}}{{bold}}2 Flaked{{/}} | {{yellow}}{{bold}}2 Pending{{/}} | {{cyan}}{{bold}}3 Skipped{{/}}",
11401145
"",

0 commit comments

Comments
 (0)