How to supress filtered tests output

When writing tests, I often only want to run a single one and skip others. What I'm doing is running them in such way

cargo watch --watch crates/ -x "test -p chunked-tilemap gen_chunk_from_noise_ranges -- --nocapture"

this will only run gen_chunk_from_noise_ranges test, just as I want. But this also will generate a lot of messages about filtered-out tests

         Finished test [unoptimized + debuginfo] target(s) in 0.31s
     Running unittests src/lib.rs (target/debug/deps/chunked_tilemap-ddb436e76d203ea7)

running 1 test
test generator::test::gen_chunk_from_noise_ranges_test ... ok

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

     Running unittests src/main.rs (target/debug/deps/chunked_tilemap-5e3543193ca22888)

running 0 tests

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

     Running tests/chunk-generator.rs (target/debug/deps/chunk_generator-c467bac1cc9940bb)

running 0 tests

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

     Running tests/despawn-out-of-range-chunks.rs (target/debug/deps/despawn_out_of_range_chunks-21b016bbdc1012a2)

running 0 tests

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

     Running tests/g1.rs (target/debug/deps/g1-385cd0028019043c)

running 0 tests

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

     Running tests/nest_chunks.rs (target/debug/deps/nest_chunks-0cbfb0b633be58c1)

running 0 tests

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

     Running tests/spawn.rs (target/debug/deps/spawn-7a53bc3b706cba0d)

running 0 tests

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

     Running tests/spawn_chunks_around_current.rs (target/debug/deps/spawn_chunks_around_current-d09cdd4a6573050f)

running 0 tests

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

     Running tests/update_current_tile.rs (target/debug/deps/update_current_tile-0cf64bace2689762)

running 0 tests

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

     Running tests/update_position_on_tilemap.rs (target/debug/deps/update_position_on_tilemap-04da3fcd21f491f5)

running 0 tests

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

Because I'm having too much of tests, I don't actually see the output of test I'm currently focusing on and I have to scroll up to see it.

Is it possible to somehow avoid this junk in output?

1 Like

It looks like your test is in main.rs, so running cargo test --bin <BIN-NAME> should run just the test suite in the named binary, and none of the test suites in any of the library crates. There are some other options available for filtering, too. See: cargo test - The Cargo Book

no, the test is in separate workspace

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.