Jest is a JavaScript testing framework with built-in assertions, mocking, snapshot testing and an interactive watch mode.
mitsuhiko/insta
A snapshot testing library for Rust that compares values against stored reference snapshots and provides tools to review changes.
- Stars
- 2,979
- Forks
- 168
- Open issues
- 78
- Last commit
- 15 days ago
What is it?
insta is a snapshot testing library for Rust. A snapshot test asserts that a value matches a stored reference, similar to assert_eq!, but it suits complex values such as large structures or output that changes often. When a snapshot changes, the test fails and the new output can be reviewed and accepted.
Snapshots can be written as separate .snap files or inline in the source file. The companion cargo-insta command-line tool handles reviewing and updating snapshots. A VS Code extension provides syntax highlighting, snapshot review, and jump-to-definition for .snap files.
Insta uses the similar crate for diffing, and the similar-asserts crate brings the same inline diff output to ordinary assert_eq! comparisons.
Key features
- 01Snapshot assertions for Debug and other serializable output.
- 02Inline snapshots stored directly in Rust source files.
- 03cargo-insta command-line tool for reviewing and updating snapshots.
- 04VS Code extension for viewing and reviewing .snap files.
- 05Inline diffs for failed comparisons via the similar library.
Use cases
- Testing complex structs or parser output where writing expected values by hand is tedious.
- Catching unintended changes in output that evolves over time.
- Reviewing snapshot changes as part of a code review workflow.
Quick start
- 1
Add the insta crate as a dev-dependency in Cargo.toml
- 2
Write a test that calls insta::assert_debug_snapshot! on a value
- 3
Install the companion cargo-insta tool to review snapshots
In collections
Topics
FAQ
- What is insta?
- A snapshot testing library for Rust that compares values against stored reference snapshots and provides tools to review changes. insta is a snapshot testing library for Rust. A snapshot test asserts that a value matches a stored reference, similar to assert_eq!, but it suits complex values such as large structures or output that changes often. When a snapshot changes, the test fails and the new output can be reviewed and accepted.
- Is insta free to use? What license does it have?
- insta is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is insta still maintained?
- Actively maintained. The last commit to insta was on Oct 10, 2026.
- What can I use insta for?
- Testing complex structs or parser output where writing expected values by hand is tedious. Catching unintended changes in output that evolves over time. Reviewing snapshot changes as part of a code review workflow.
- How do I install insta?
- Add the insta crate as a dev-dependency in Cargo.toml Write a test that calls insta::assert_debug_snapshot! on a value Install the companion cargo-insta tool to review snapshots
- Where can I get insta?
- The source code and installation instructions are on GitHub: https://github.com/mitsuhiko/insta
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A Go testing toolkit providing assertions, mocks, and a suite structure that works with the standard go test runner.
A header-based unit testing framework for C++ with simple assertions, BDD-style macros, and basic micro-benchmarking.
AVA is a concurrent test runner for Node.js with a concise API, detailed error output and per-file thread isolation.
PHPUnit is a programmer-oriented unit testing framework for PHP, following the xUnit architecture.
Lightweight React DOM testing utilities that query and interact with components the way users do.