@@ -31,13 +31,13 @@ type Runner struct {
3131 prettyProjectPath string // Go project package path, formatted for pretty printing.
3232 Verbose bool // If true, provides detailed logging.
3333 RunCount int // Number of times to run the tests.
34+ RerunCount int // Number of additional runs for tests that initially fail.
3435 UseRace bool // Enable race detector.
3536 Timeout time.Duration // Test timeout
3637 Tags []string // Build tags.
3738 UseShuffle bool // Enable test shuffling. -shuffle=on flag.
3839 ShuffleSeed string // Set seed for test shuffling -shuffle={seed} flag. Must be used with UseShuffle.
3940 FailFast bool // Stop on first test failure.
40- RerunFailed int // Number of additional runs for tests that initially fail.
4141 SkipTests []string // Test names to exclude.
4242 SelectTests []string // Test names to include.
4343 CollectRawOutput bool // Set to true to collect test output for later inspection.
@@ -77,22 +77,11 @@ func (r *Runner) RunTestPackages(packages []string) (*reports.TestReport, error)
7777 }
7878
7979 // Parse initial results.
80- results , err := r .parseTestResults (jsonFilePaths , "run" )
80+ results , err := r .parseTestResults (jsonFilePaths , "run" , r . RunCount )
8181 if err != nil {
8282 return nil , fmt .Errorf ("failed to parse test results: %w" , err )
8383 }
8484
85- // Rerun failing tests (only the unique tests).
86- // if r.RerunFailed > 0 {
87- // rerunResults, err := r.rerunFailedTests(results)
88- // if err != nil {
89- // return nil, fmt.Errorf("failed to rerun failing tests: %w", err)
90- // }
91-
92- // // Merge rerun results with initial results.
93- // mergeTestResults(&results, rerunResults)
94- // }
95-
9685 report := & reports.TestReport {
9786 GoProject : r .prettyProjectPath ,
9887 RaceDetection : r .UseRace ,
@@ -124,7 +113,7 @@ func (r *Runner) RunTestCmd(testCmd []string) (*reports.TestReport, error) {
124113 }
125114 }
126115
127- results , err := r .parseTestResults (jsonFilePaths , "run" )
116+ results , err := r .parseTestResults (jsonFilePaths , "run" , r . RunCount )
128117 if err != nil {
129118 return nil , fmt .Errorf ("failed to parse test results: %w" , err )
130119 }
@@ -229,10 +218,6 @@ func (r *Runner) runCmd(testCmd []string, runIndex int) (tempFilePath string, pa
229218 }
230219 defer tmpFile .Close ()
231220
232- if r .Verbose {
233- log .Info ().Msgf ("Running custom test command (%d/%d): %s" , runIndex + 1 , r .RunCount , strings .Join (testCmd , " " ))
234- }
235-
236221 cmd := exec .Command (testCmd [0 ], testCmd [1 :]... )
237222 cmd .Dir = r .ProjectPath
238223
@@ -300,7 +285,7 @@ func (e entry) String() string {
300285// panics and failures at that point.
301286// Subtests add more complexity, as panics in subtests are only reported in their parent's output,
302287// and cannot be accurately attributed to the subtest that caused them.
303- func (r * Runner ) parseTestResults (filePaths []string , runPrefix string ) ([]reports.TestResult , error ) {
288+ func (r * Runner ) parseTestResults (filePaths []string , runPrefix string , runCount int ) ([]reports.TestResult , error ) {
304289 // If the option is enabled, transform each JSON output file before parsing.
305290 if r .IgnoreParentFailuresOnSubtests {
306291 transformedPaths , err := r .transformTestOutputFiles (filePaths )
@@ -319,7 +304,7 @@ func (r *Runner) parseTestResults(filePaths []string, runPrefix string) ([]repor
319304 panicDetectionMode = false
320305 raceDetectionMode = false
321306 detectedEntries = []entry {} // race or panic entries
322- expectedRuns = r . RunCount
307+ expectedRuns = runCount
323308 )
324309
325310 runNumber := 0
@@ -755,7 +740,7 @@ func (r *Runner) RerunFailedTests(results []reports.TestResult) (*reports.TestRe
755740 var rerunJsonFilePaths []string
756741
757742 // Rerun each failing test package up to RerunFailed times
758- for i := range r .RerunFailed {
743+ for i := range r .RerunCount {
759744 for pkg , tests := range failingTestsByPackage {
760745 // Build regex pattern to match all failing tests in this package
761746 testPattern := fmt .Sprintf ("^(%s)$" , strings .Join (tests , "|" ))
@@ -794,7 +779,7 @@ func (r *Runner) RerunFailedTests(results []reports.TestResult) (*reports.TestRe
794779 }
795780
796781 // Parse all rerun results at once with a consistent prefix
797- rerunResults , err := r .parseTestResults (rerunJsonFilePaths , "rerun" )
782+ rerunResults , err := r .parseTestResults (rerunJsonFilePaths , "rerun" , r . RerunCount )
798783 if err != nil {
799784 return nil , fmt .Errorf ("failed to parse rerun results: %w" , err )
800785 }
0 commit comments