@@ -174,6 +174,7 @@ func TestResultsTable(
174174 results []TestResult ,
175175 expectedPassRatio float64 ,
176176 includeCodeOwners bool ,
177+ markdown bool ,
177178) (resultsTable [][]string , runs , passes , fails , skips , panickedTests , racedTests , flakyTests int ) {
178179 p := message .NewPrinter (language .English ) // For formatting numbers
179180 sortTestResults (results )
@@ -196,6 +197,11 @@ func TestResultsTable(
196197 if includeCodeOwners {
197198 headers = append (headers , "Code Owners" )
198199 }
200+ if markdown {
201+ for i , header := range headers {
202+ headers [i ] = fmt .Sprintf ("**%s**" , header )
203+ }
204+ }
199205
200206 resultsTable = [][]string {}
201207 resultsTable = append (resultsTable , headers )
@@ -249,6 +255,7 @@ func PrintResults(
249255 w io.Writer ,
250256 tests []TestResult ,
251257 maxPassRatio float64 ,
258+ markdown bool ,
252259 includeCodeOwners bool , // Include code owners in the output. Set to true if test results have code owners
253260) (runs , passes , fails , skips , panickedTests , racedTests , flakyTests int ) {
254261 var (
@@ -257,7 +264,7 @@ func PrintResults(
257264 flakeRatioStr string
258265 p = message .NewPrinter (language .English ) // For formatting numbers
259266 )
260- resultsTable , runs , passes , fails , skips , panickedTests , racedTests , flakyTests = TestResultsTable (tests , maxPassRatio , includeCodeOwners )
267+ resultsTable , runs , passes , fails , skips , panickedTests , racedTests , flakyTests = TestResultsTable (tests , maxPassRatio , markdown , includeCodeOwners )
261268 // Print out summary data
262269 if runs == 0 || passes == runs {
263270 passRatioStr = "100%"
@@ -283,6 +290,15 @@ func PrintResults(
283290 {"Skips" , p .Sprint (skips )},
284291 {"Pass Ratio" , passRatioStr },
285292 }
293+ if markdown {
294+ for i , row := range summaryData {
295+ if i == 0 {
296+ summaryData [i ] = []string {"**Category**" , "**Total**" }
297+ } else {
298+ summaryData [i ] = []string {fmt .Sprintf ("**%s**" , row [0 ]), row [1 ]}
299+ }
300+ }
301+ }
286302
287303 colWidths := make ([]int , len (summaryData [0 ]))
288304
@@ -401,7 +417,7 @@ func MarkdownSummary(w io.Writer, testReport *TestReport, maxPassRatio float64,
401417 return
402418 }
403419
404- allRuns , passes , _ , _ , _ , _ , _ := PrintResults (testsData , tests , maxPassRatio , includeCodeOwners )
420+ allRuns , passes , _ , _ , _ , _ , _ := PrintResults (testsData , tests , maxPassRatio , true , includeCodeOwners )
405421 if allRuns > 0 {
406422 avgPassRatio = float64 (passes ) / float64 (allRuns )
407423 }
0 commit comments