-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
proposal: cmd/go: change go test to FAIL if -run
is specified but no tests match
#64500
Comments
Slightly related, but in the opposite direction: |
-run
is specified but no tests match-run
is specified but no tests match
For the reference: I'm using |
@navytux That's a good point. In the original proposal here, there was only the -run flag specified, without -bench, so it likely shouldn't apply if something else, like benchmarks, does match and run. As a side note, there is a possibility of that invocation matching some tests if they happen to have that character in their name. Since |
@dmitshur, thanks for feedback. And I agree that |
Will add to proposal minutes next week, but I don't see how to do this in a defensible way.
All these strange contradictions go away if The original design of this warning in #15211 explicitly left the exit code unchanged to avoid all these problems. I think we should continue to leave it unchanged. |
This proposal has been added to the active column of the proposals project |
Given the tricky contradictions in this proposal, I don't think we can do this, unfortunately. If someone finds a way to thread that needle, we can of course revisit. :) |
Based on the discussion above, this proposal seems like a likely decline. |
No change in consensus, so declined. |
Proposal Details
If
-run
is provided but there is no test matching the pattern,go test
currently considers the test run PASS and exits with 0.Even though there is a warning like "testing: warning: no tests to run", this is easy to miss or dropped when the test binary runs by other runners (ide plugins, dlv, ..). I think when users set
-run
and if there is no matching test, that's likely not what users wanted, and treating it like misuse of command is more appropriate.The text was updated successfully, but these errors were encountered: