nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: gotestyourself/gotestsum
Pull request #448 (2024-11-02 04:14:43)

fix(validate): fixes check for test.failfast flag as this is a gotest…
Our pipeline would sometimes pass without checking all tests as we had reruns and fail fast enabled.


Patch:
diff --git a/cmd/main.go b/cmd/main.go
index a71395d..2a287fc 100644
--- a/cmd/main.go
+++ b/cmd/main.go
@@ -208,8 +208,10 @@ func (o options) Validate() error {
 			"when go test args are used with --rerun-fails " +
 				"the list of packages to test must be specified by the --packages flag")
 	}
-	if o.rerunFailsMaxAttempts > 0 && boolArgIndex("failfast", o.args) > -1 {
-		return fmt.Errorf("-failfast can not be used with --rerun-fails " +
+	if o.rerunFailsMaxAttempts > 0 &&
+		(boolArgIndex("failfast", o.args) > -1 ||
+			boolArgIndex("test.failfast", o.args) > -1) {
+		return fmt.Errorf("-(test.)failfast can not be used with --rerun-fails " +
 			"because not all test cases will run")
 	}
 	return nil


Test patch:
diff --git a/cmd/main_test.go b/cmd/main_test.go
index c28d5de..a619511 100644
--- a/cmd/main_test.go
+++ b/cmd/main_test.go
@@ -86,7 +86,12 @@ func TestOptions_Validate_FromFlags(t *testing.T) {
 		{
 			name:     "rerun-fails with failfast",
 			args:     []string{"--rerun-fails", "--packages=./...", "--", "-failfast"},
-			expected: "-failfast can not be used with --rerun-fails",
+			expected: "-(test.)failfast can not be used with --rerun-fails",
+		},
+		{
+			name:     "rerun-fails with failfast",
+			args:     []string{"--rerun-fails", "--packages=./...", "--", "-test.failfast"},
+			expected: "-(test.)failfast can not be used with --rerun-fails",
 		},
 	}
 	for _, tc := range testCases {