Cargo test's verbose output - can I quiet it?

Friends

When I run cargo test the_name_of_the_test I get screeds of output that is irrelevant.

Running cargo test --quiet... is better but still a lot of stuff I do not care about.

Am I missing something? Is there a better way of running them?

E.g:

$ cargo test --quiet engine_send_to_loop_without_channel_errors 

running 1 test
.
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 33 filtered out; finished in 0.00s


running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s


running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s


running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out; finished in 0.00s

There is one line, amongst 20, that has useful information for me.

I don't think there is currently a way to get rid of those starting and finishing lines, but it looks like your project has 2 Cargo targets (out of 4) which have no tests at all (0 filtered out). You can exclude those targets by default, and cut the amount of output in half, by setting test = false in the relevant target section in your Cargo.toml, e.g.

[[bin]]
name = "my-program"
test = false

You could also use Nextest which takes over all test output.

Nope. The "protocol" between Cargo and glue code from rustc that runs the tests is basically non-existent, so Cargo doesn't know what has tests and what doesn't, and has no way of removing those "ran 0 tests" bits.

There was an attempt to make a protocol or harness for tests that would let Cargo fix the absurdity, but it was a case of perfect being enemy of good. The paralysis of designing a perfect universal stable custom test framework harness that solves all problems for everyone, means that nothing ever got implemented and we're stuck forever with dumb protocol that doesn't solve even basic problems for anybody.

nexttest is not perfect, but it is a huge help.