@@ -72,37 +72,22 @@ var RunTestsCmd = &cobra.Command{
7272 os .Exit (1 )
7373 }
7474
75- // Print all failed tests including flaky tests
76- if printFailedTests {
77- fmt .Printf ("PassRatio threshold for flaky tests: %.2f\n " , maxPassRatio )
78- // Use RenderResults instead of PrintResults
79- reports .RenderResults (os .Stdout , testReport .Results , maxPassRatio , false )
80- }
81-
8275 // Save the test results in JSON format
8376 if outputPath != "" && len (testReport .Results ) > 0 {
8477 jsonData , err := json .MarshalIndent (testReport , "" , " " )
8578 if err != nil {
8679 log .Fatalf ("Error marshaling test results to JSON: %v" , err )
8780 }
88- if err := os .WriteFile (outputPath , jsonData , 0644 ); err != nil {
81+ if err := os .WriteFile (outputPath , jsonData , 0600 ); err != nil {
8982 log .Fatalf ("Error writing test results to file: %v" , err )
9083 }
9184 fmt .Printf ("All test results saved to %s\n " , outputPath )
9285 }
9386
94- // Filter flaky tests using FilterTests
95- flakyTests := reports .FilterTests (testReport .Results , func (tr reports.TestResult ) bool {
96- return ! tr .Skipped && tr .PassRatio < maxPassRatio
97- })
98-
99- if len (flakyTests ) > 0 {
100- fmt .Printf ("Found %d flaky tests below the pass ratio threshold of %.2f:\n " , len (flakyTests ), maxPassRatio )
101- reports .RenderResults (os .Stdout , flakyTests , maxPassRatio , false )
102- // Exit with error code if there are flaky tests
103- os .Exit (1 )
104- } else if len (testReport .Results ) == 0 {
105- fmt .Printf ("No tests were run for the specified packages.\n " )
87+ // Print all failed tests including flaky tests
88+ if printFailedTests {
89+ fmt .Printf ("\n Flakeguard Summary\n " )
90+ reports .RenderResults (os .Stdout , testReport .Results , maxPassRatio , false )
10691 }
10792 },
10893}
0 commit comments