Cannot silence test runner
cargo 0.17.0-nightly (740f9c0 2016-12-29)
We should be able to silence the test runner's stdout via --quiet like build and clean's --quiet flag, but alas this is not currently done.
tmba:sentinel thill $ cargo test --quiet -- quiet
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
tmba:sentinel thill $ cargo test --quiet
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
ref: https://github.com/rust-lang/cargo/issues/3482
--quietprints a compact version of the normal output:Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs Running /Users/sfackler/code/rust-openssl/target/debug/deps/openssl-3ace7e2ac4871275 running 146 tests .................................................................................................................................................. test result: ok. 146 passed; 0 failed; 0 ignored; 0 measuredSeems reasonable for
--quiet --quietto completely suppress output though.Steven Fackler at 2017-01-01 18:51:57
But
--quietdoesn't even do that for me.tmba:sentinel thill $ cargo test --quiet running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measuredtmba:sentinel thill $ cargo test -- --quiet Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs Running target/debug/deps/sentinel-0ecd9a282af25c50 running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured Doc-tests sentinel running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measuredphrohdoh at 2017-01-01 19:24:53
Why doesn't it? It's displaying zero dots for the zero tests it ran.
Steven Fackler at 2017-01-01 19:25:36
I feel like ultimately -qq could silence test runs completely and just return the exit code; or perhaps we could have an
--exit-codeoption that did the equivalent.Mark Rousskov at 2017-05-18 16:05:18
Even with
cargo test --quiet -- --quiet(!), it is excessively verbose:$ cargo test --quiet -- --quiet running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out running 7 tests ....... test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out running 1 test . test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered outWith
--all, this output can easily span multiple pages for a reasonably sized workspace.It would be nice to merge all the blocks instead, to eliminate the useless noise (and make
--alloutput actually glanceable):$ cargo test --quiet -- --quiet running 8 tests ........ test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered outGregory Petrosyan at 2017-08-12 13:42:48
I agree that an even quieter setting would be valuable. I would like to see a PR with an implementation.
In general there is a lot of room for improvement in the
cargo testexperience. At some point I would love for someone to reimagine howcargo testwould work in an ideal world -- a bit like what has been done for error messages over the past year. It would be so wonderful if someone takes the initiative to come up with some design proposals. The RFCs repo or the users forum would be the place to follow up.David Tolnay at 2017-11-18 23:46:36
Triage: no changes
Steve Klabnik at 2020-02-23 20:33:31