Setting default-member on a workspace makes cargo test only test one project #13855
Labels
A-cli
Area: Command-line interface, option parsing, etc.
A-workspaces
Area: workspaces
C-bug
Category: bug
Command-test
S-triage
Status: This issue is waiting on initial triage.
Problem
Rust strives itself to not have footguns and make development a pleasure. Unfortunately the current setup of using
default-member
to set the default cargo run binary is deeply flawed and dangerous: Most of the workspace's tests are no longer run. No warnings are given that you're just running one projects tests rather than the expected full workspace.Steps
Set
default-member = "..."
on a workspaceCargo.toml
Possible Solution(s)
It would be better to remove
default-member
if we're not going to run all the tests as it's such a footgun. (Or add a big warning? - ideally after the test output as there can be a lot of output)Notes
This has been discussed before ( #7290 ), but I'm opening this as a bug because this is a big footgun. Nobody expects
cargo test
at the root level of a workspace to just run one project's tests. It can go un-noticed for quite a time if on the CI you just see that all the tests are green. Rust prides itself on being as safe a language as it can be, but in this particular instance we're not living up to our values. (I'm happy to code up any agreed upon solution, but what we have now isn't a great situation.)Version
No response
The text was updated successfully, but these errors were encountered: