finds.dev← search

// the find

mitsuhiko/insta

★ 2,891 · Rust · Apache-2.0 · updated Jun 2026

A snapshot testing library for rust

insta is a snapshot testing library for Rust that stores expected output in `.snap` files and lets you accept or reject changes via the companion `cargo-insta` CLI. It's aimed at Rust developers testing complex serializable outputs — parsers, serializers, API responses — where writing out expected strings by hand is tedious and brittle.

The redaction system is genuinely useful: you can mask out fields like timestamps or random IDs with selectors before snapshotting, so tests don't flap on non-deterministic data. Inline snapshots (stored directly in the source file) are a nice option for small values — keeps the assertion close to the test without a separate file. The `cargo-insta review` workflow (accept/reject each changed snapshot interactively) is well thought out and makes reviewing a batch of changes after a refactor much less painful than doing it by hand. The VS Code extension with jump-to-definition and snapshot review in the editor is a real quality-of-life addition, not just a gimmick.

The snapshot files are plain text committed to the repo, which means any serialization format change produces a diff across potentially dozens of `.snap` files — git history gets noisy fast if your output format evolves. There's no built-in way to snapshot non-serializable types; you have to implement `Debug` or `Serialize`, which pushes formatting concerns into production code. The `cargo-insta` CLI is a separate binary you have to install, so CI setup requires an extra step and pin a version manually to avoid drift. YAML is the default snapshot format, which is readable but has edge cases around multiline strings and special characters that can cause spurious whitespace diffs.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →