Skip to content

Commit

Permalink
Merge pull request #448 from aldiesel/main
Browse files Browse the repository at this point in the history
fix(validate): fixes check for test.failfast flag as this is a gotest…
  • Loading branch information
dnephin authored Nov 4, 2024
2 parents 6432e97 + fd36d2b commit 31f5275
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion cmd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 31f5275

Please sign in to comment.