Skip to content

Commit df2b819

Browse files
committed
Add printFailedTests flag
1 parent d5a4c34 commit df2b819

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/flakeguard/cmd/run.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var RunTestsCmd = &cobra.Command{
2525
outputPath, _ := cmd.Flags().GetString("output-json")
2626
threshold, _ := cmd.Flags().GetFloat64("threshold")
2727
skipTests, _ := cmd.Flags().GetStringSlice("skip-tests")
28+
printFailedTests, _ := cmd.Flags().GetBool("print-failed-tests")
2829

2930
// Check if project dependencies are correctly set up
3031
if err := checkDependencies(projectPath); err != nil {
@@ -62,7 +63,7 @@ var RunTestsCmd = &cobra.Command{
6263
failedTests := reports.FilterFailedTests(testResults, threshold)
6364
skippedTests := reports.FilterSkippedTests(testResults)
6465

65-
if len(failedTests) > 0 {
66+
if len(failedTests) > 0 && printFailedTests {
6667
fmt.Printf("PassRatio threshold for flaky tests: %.2f\n", threshold)
6768
fmt.Printf("%d failed tests:\n", len(failedTests))
6869
reports.PrintTests(failedTests, os.Stdout)
@@ -102,6 +103,7 @@ func init() {
102103
RunTestsCmd.Flags().String("output-json", "", "Path to output the test results in JSON format")
103104
RunTestsCmd.Flags().Float64("threshold", 0.8, "Threshold for considering a test as flaky")
104105
RunTestsCmd.Flags().StringSlice("skip-tests", nil, "Comma-separated list of test names to skip from running")
106+
RunTestsCmd.Flags().Bool("print-failed-tests", true, "Print failed test results to the console")
105107
}
106108

107109
func checkDependencies(projectPath string) error {

0 commit comments

Comments
 (0)