Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rerun-fails with compiled test binary #149

Merged
merged 1 commit into from
Sep 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Note that using `--rerun-fails` may require the use of other flags, depending on
how you specify args to `go test`:

* when used with `--raw-command` the re-run will pass additional arguments to
the command. The first arg is a `-run` flag with a regex that matches the test to re-run,
the command. The first arg is a `-test.run` flag with a regex that matches the test to re-run,
and second is the name of a go package. These additional args can be passed to `go test`,
or a test binary.
* when used with any `go test` args (anything after `--` on the command line), the list of
Expand Down
4 changes: 2 additions & 2 deletions rerunfails.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ func (r *failureRecorder) count() int {
func goTestRunFlagForTestCase(name string) string {
root, sub := testjson.SplitTestName(name)
if sub == "" {
return "-run=^" + name + "$"
return "-test.run=^" + name + "$"
}
return "-run=^" + root + "$/^" + sub + "$"
return "-test.run=^" + root + "$/^" + sub + "$"
}

func writeRerunFailsReport(opts *options, exec *testjson.Execution) error {
Expand Down
4 changes: 2 additions & 2 deletions rerunfails_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ func TestGoTestRunFlagFromTestCases(t *testing.T) {
var testCases = map[string]testCase{
"root test case": {
input: "TestOne",
expected: "-run=^TestOne$",
expected: "-test.run=^TestOne$",
},
"sub test case": {
input: "TestOne/SubtestA",
expected: "-run=^TestOne$/^SubtestA$",
expected: "-test.run=^TestOne$/^SubtestA$",
},
}
for name := range testCases {
Expand Down