RC RANDOM CHAOS

Cargo-nextest: A Faster, Isolated Test Runner for Rust with CI Superpowers

· via Hacker News

Original source

Cargo-nextest: 3x faster than cargo test, per-test isolation, first-class CI

Hacker News →

Cargo-nextest is an open-source test runner for Rust that positions itself as a drop-in replacement for the built-in cargo test. Its main pitch is speed — a redesigned execution model that runs suites up to 3x faster — combined with per-test process isolation, so a crash or hang in one test can’t take down the rest of the run. Installation is a single pre-built binary, after which cargo nextest run replaces the standard command. The one notable gap is doctests, which stable Rust doesn’t yet expose to third-party runners, so those still have to run separately via cargo test --doc.

Where nextest distinguishes itself is operational tooling around tests rather than just running them. It ships an expression-based selection language for filtering by name, binary, or platform; per-test configuration for retries, serial execution, and slow-test detection; and stress-testing loops to flush out flaky tests. Runs can be recorded, replayed locally from CI, and exported as Perfetto traces or JUnit XML.

The CI story is the strongest selling point: tests can be archived and partitioned across multiple workers, environment-specific profiles are supported, and setup scripts with per-test scoping let you spin up databases or services as fixtures before execution. It integrates with a broader ecosystem for coverage collection, mutation testing, and runtime observability via DTrace and bpftrace. Cross-platform and already adopted from small open-source projects up to large tech companies, it treats test infrastructure as a first-class engineering concern rather than an afterthought.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.