Skip to content

Commit 34fa8f2

Browse files
committed
Show no tests executed in reports when no test results
1 parent 6653333 commit 34fa8f2

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

tools/flakeguard/reports/presentation.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,17 @@ func formatPassRatio(passRatio float64) string {
8484
}
8585

8686
func GenerateGitHubSummaryMarkdown(w io.Writer, testReport *TestReport, maxPassRatio float64, artifactName, artifactLink string) {
87-
settingsTable := buildSettingsTable(testReport, maxPassRatio)
8887
fmt.Fprint(w, "# Flakeguard Summary\n\n")
89-
printTable(w, settingsTable)
90-
fmt.Fprintln(w)
9188

9289
if len(testReport.Results) == 0 {
93-
fmt.Fprintln(w, "## No tests ran :warning:")
90+
fmt.Fprintln(w, "No tests were executed.")
9491
return
9592
}
9693

94+
settingsTable := buildSettingsTable(testReport, maxPassRatio)
95+
printTable(w, settingsTable)
96+
fmt.Fprintln(w)
97+
9798
summary := GenerateSummaryData(testReport.Results, maxPassRatio)
9899
if summary.FlakyTests > 0 {
99100
fmt.Fprintln(w, "## Found Flaky Tests :x:")
@@ -111,6 +112,11 @@ func GenerateGitHubSummaryMarkdown(w io.Writer, testReport *TestReport, maxPassR
111112
func GeneratePRCommentMarkdown(w io.Writer, testReport *TestReport, maxPassRatio float64, baseBranch, currentBranch, currentCommitSHA, repoURL, actionRunID, artifactName, artifactLink string) {
112113
fmt.Fprint(w, "# Flakeguard Summary\n\n")
113114

115+
if len(testReport.Results) == 0 {
116+
fmt.Fprintln(w, "No tests were executed.")
117+
return
118+
}
119+
114120
// Construct additional info
115121
additionalInfo := fmt.Sprintf(
116122
"Ran new or updated tests between `%s` and %s (`%s`).",
@@ -132,11 +138,6 @@ func GeneratePRCommentMarkdown(w io.Writer, testReport *TestReport, maxPassRatio
132138
fmt.Fprintln(w, linksLine)
133139
fmt.Fprintln(w) // Add an extra newline for formatting
134140

135-
if len(testReport.Results) == 0 {
136-
fmt.Fprintln(w, "## No tests ran :warning:")
137-
return
138-
}
139-
140141
// Add the flaky tests section
141142
if GenerateSummaryData(testReport.Results, maxPassRatio).FlakyTests > 0 {
142143
fmt.Fprintln(w, "## Found Flaky Tests :x:")

0 commit comments

Comments
 (0)