nextest
nextest copied to clipboard
Provide a hint to use `cargo nextest run` if no command is specified
For the most part cargo nextest
is interchangeable with cargo test
, but not when swapping one out for the other with cargo-hack
.
For example, the following error is seen when invoking cargo-nextest
via cargo-hack
:
$ cargo hack --feature-powerset nextest
info: running `cargo nextest --no-default-features` on soroban-sdk (1/22)
error: Found argument '--no-default-features' which wasn't expected, or isn't valid in this context
If you tried to supply `--no-default-features` as a value rather than a flag, use `-- --no-default-features`
USAGE:
cargo nextest --manifest-path <PATH>
For more information try --help
error: process didn't exit successfully: `/Users/leighmcculloch/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo nextest --manifest-path soroban-sdk/Cargo.toml --no-default-features` (exit status: 2)
Ideally the behavior of cargo-nextest
for handling argument would be identical to cargo test
so that nextest can be used in all the places that cargo test is used.
These are simpler commands that demonstrate the difference in behavior:
$ cargo nextest --no-default-features
error: Found argument '--no-default-features' which wasn't expected, or isn't valid in this context
If you tried to supply `--no-default-features` as a value rather than a flag, use `-- --no-default-features`
USAGE:
cargo nextest [OPTIONS] <SUBCOMMAND>
For more information try --help
$ cargo test --no-default-features
...
Ugh, sorry, I forgot to include the run
subcommand to nextest. This all works fine if I use cargo nextest run
.
I think we should provide a hint for this -- this seems to be a common issue. Reopening for that.
It might be reasonable to default to run
when no sub-command is provided rather than defaulting to an error or help message.
Down that way lies a lot of pain, e.g. what happens if you want to filter based on tests called "run" or "list". In general nextest tends to prefer teaching users instead of automatically correcting them.