@@ -720,17 +720,11 @@ func prettyProjectPath(projectPath string) (string, error) {
720720 return "" , fmt .Errorf ("module path not found in go.mod" )
721721}
722722
723- func (r * Runner ) RerunFailedTests (results []reports.TestResult ) (* reports.TestReport , error ) {
724- // Group failing tests by package for more efficient reruns
723+ func (r * Runner ) RerunFailedTests (failedTests []reports.TestResult ) (* reports.TestReport , error ) {
724+ // Group the provided failed tests by package for more efficient reruns
725725 failingTestsByPackage := make (map [string ][]string )
726- for _ , tr := range results {
727- if ! tr .Skipped {
728- // if !tr.Skipped && tr.PassRatio < 1 { //TODO uncomment
729- if _ , exists := failingTestsByPackage [tr .TestPackage ]; ! exists {
730- failingTestsByPackage [tr .TestPackage ] = []string {}
731- }
732- failingTestsByPackage [tr .TestPackage ] = append (failingTestsByPackage [tr .TestPackage ], tr .TestName )
733- }
726+ for _ , tr := range failedTests {
727+ failingTestsByPackage [tr .TestPackage ] = append (failingTestsByPackage [tr .TestPackage ], tr .TestName )
734728 }
735729
736730 if r .Verbose {
@@ -739,7 +733,7 @@ func (r *Runner) RerunFailedTests(results []reports.TestResult) (*reports.TestRe
739733
740734 var rerunJsonFilePaths []string
741735
742- // Rerun each failing test package up to RerunFailed times
736+ // Rerun each failing test package up to RerunCount times
743737 for i := range r .RerunCount {
744738 for pkg , tests := range failingTestsByPackage {
745739 // Build regex pattern to match all failing tests in this package
@@ -773,7 +767,6 @@ func (r *Runner) RerunFailedTests(results []reports.TestResult) (*reports.TestRe
773767 if err != nil {
774768 return nil , fmt .Errorf ("error on rerunCmd for package %s: %w" , pkg , err )
775769 }
776-
777770 rerunJsonFilePaths = append (rerunJsonFilePaths , jsonFilePath )
778771 }
779772 }
0 commit comments