Cargo test --workspace // only show failed tests?

I have cargo test --workspace running inside a cargo watch. (This is fine, the unit tests are all ultra fast).

The workspace has 70+ crates, and I only care about the FAILED unit tests.

Is there a way to have cargo test --workspace silence all the successful crate runs, and only show the failed crates / tests ?

One of my pet peeves too. Way too verbose and -q doesn’t help much :<

It's not difficult for cargo-pretty-test mainly written by me to do this by supporting a --show-failed-only arguement.

Can you also add an option that watches a workspace, and on file change, only reruns the test of the modified crate ? :slight_smile:

No. There are some tools for it.

Which tools are these? I'm currently writing a script to find all Cargo.toml and manually setup a cargo watch / cargo test PER CRATE.

Can you add the tests to each crate and export them as modules to the parent crate?

bacon test

Oh, I find it meets your needs because it only shows the failed tests[1] and watches your project. video


  1. it also shows error location in source code if you use other bacon commands ↩︎

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.