A command line tool for summarizing cargo test output. The Rust version of tparse.
Tip
Run cargo test with JSON output and pipe stderr too (2>&1).
By default, cargo tparse prints each failed test with its output and a command to rerun only that test, followed by a summary table (one row per test target).
FAIL t::fails alpha-core lib
thread 't::fails' panicked at crates/alpha-core/src/lib.rs:16:30:
boom
rerun: cargo test -p alpha-core --lib -- t::fails --exact
┌────────┬─────────┬────────────┬────────┬──────┬──────┬──────┐
│ Status │ Elapsed │ Package │ Target │ Pass │ Fail │ Skip │
├────────┼─────────┼────────────┼────────┼──────┼──────┼──────┤
│ FAIL │ 0.00s │ alpha-core │ lib │ 2 │ 1 │ 0 │
│ PASS │ 0.00s │ beta │ bin │ 1 │ 0 │ 0 │
└────────┴─────────┴────────────┴────────┴──────┴──────┴──────┘
3 passed, 1 failed, 0 skipped in 0.00s (build 0.42s, total 0.61s)
cargo install cargo-tparse
Pipe cargo test JSON output to cargo tparse:
cargo +nightly test --no-fail-fast -- -Z unstable-options --format json 2>&1 | cargo tparse
- libtest JSON output is unstable and requires nightly; the same pipe will work on stable once stabilized.
2>&1letscargo tparseread package and target names from cargo'sRunninglines.--no-fail-fastruns every test target instead of stopping at the first failure.
Read saved output: cargo tparse < test.out. Exits with 1 if any test fails.
Options:
--format <table|markdown> Output format (default: table)
--by <target|package> One row for each test target or each package (default: target)
--sort <name|elapsed> Sort rows by name, or by elapsed time with the slowest first (default: name)
--slow <N> Show the N slowest passed tests of each package (needs --report-time)
--progress Print cargo's build status, and a line for each test target as it finishes