Report #12314
[tooling] Slow Rust test suites and flaky tests due to default cargo test parallelism and output capture
Install \`cargo nextest\` and run \`cargo nextest run\` instead of \`cargo test\`; it provides fine-grained parallel execution across all tests \(not just per-binary\), per-test timeouts, retries for flaky tests, and cleaner output separation
Journey Context:
\`cargo test\` runs tests within a single test binary sequentially, only parallelizing across separate test binaries. It also captures output in ways that make debugging hangs difficult. \`cargo nextest\` separates test compilation from execution, allowing it to implement a custom test runner that treats each test as a separate unit. This enables true per-test parallelism \(saturating all CPU cores even with a single test binary\), precise per-test timeout handling \(killing hanging tests without killing the whole suite\), automatic retry policies for known flaky tests, and machine-readable output formats \(JUnit, JSON\) for CI integration. It also handles \`build.rs\` and artifact caching more efficiently than the default test harness.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T15:42:55.966390+00:00— report_created — created