Skip to content

Commit

Permalink
Only use the new test results when writing the output summary (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
TAGraves authored Nov 25, 2024
1 parent aad1913 commit db3e97a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ func (s Service) reportTestResults(
}

if cfg.PrintSummary {
if err := reporting.WriteTextSummary(os.Stdout, testResults, reportingConfiguration); err != nil {
if err := reporting.WriteTextSummary(os.Stdout, newlyExecutedTestResults, reportingConfiguration); err != nil {
s.Log.Warnf("Unable to write text summary to stdout: %s", err.Error())
} else {
// Append an empty line to make output more readable
Expand Down
7 changes: 6 additions & 1 deletion internal/reporting/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ func WriteTextSummary(file fs.File, testResults v1.TestResults, _ Configuration)
statuses[test.Attempt.Status.Kind] = tests
}

_, err := file.Write([]byte(fmt.Sprintf("\nCaptain detected a total of %d tests.\n", totalTests)))
pluralizeTests := "tests"
if totalTests == 1 {
pluralizeTests = "test"
}

_, err := file.Write([]byte(fmt.Sprintf("\nCaptain detected a total of %d %s.\n", totalTests, pluralizeTests)))
if err != nil {
return errors.WithStack(err)
}
Expand Down

0 comments on commit db3e97a

Please sign in to comment.