Need help with insta?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

mitsuhiko
835 Stars 40 Forks Apache License 2.0 416 Commits 14 Opened issues

Description

A snapshot testing library for rust

Services available

!
?

Need anything else?

Contributors list

# 127
Python
Rust
Flask
sentry
370 commits
# 38,589
Rust
pandas
elisp
Apache ...
13 commits
# 36,495
c-sharp
Rust
Xamarin
Univers...
4 commits
# 14,815
rust-la...
intelli...
imagema...
hackerr...
2 commits
# 219,111
React
pybulle...
messeng...
sql-dat...
2 commits
# 125,959
Rust
Django
JavaFX
rust-la...
2 commits
# 318,970
Shell
C
TypeScr...
vscode-...
1 commit
# 1,042
Python
vcard
sentry
carddav
1 commit
# 50,352
spotify
vala
socat
Ubuntu
1 commit
# 166,333
Rust
Lua
ngx-lua
test-fr...
1 commit
# 129,526
Rust
command...
argumen...
ESLint
1 commit
# 114,145
Rust
cloudfl...
C
dwarf-f...
1 commit
# 85,825
Objecti...
React N...
React
Babel
1 commit
# 311,140
Shell
static-...
Jupyter...
TypeScr...
1 commit
# 1,044
TypeScr...
Babel
Electro...
ESLint
1 commit
# 127,292
Rust
Kuberne...
R
rust-bi...
1 commit
# 86,269
Lua
React
luajit
Rust
1 commit
# 137,436
Rust
Shell
axios
HTML
1 commit
# 3,641
JavaScr...
ecmascr...
yarn
Package...
1 commit
# 186,675
univers...
robotic...
MATLAB
Jekyll
1 commit

insta: a snapshot testing library for Rust

Build Status Crates.io License Documentation VSCode Extension

Introduction

Snapshots tests (also sometimes called approval tests) are tests that assert values against a reference value (the snapshot). This is similar to how

assert_eq!
lets you compare a value against a reference value but unlike simple string assertions, snapshot tests let you test against complex values and come with comprehensive tools to review changes.

Snapshot tests are particularly useful if your reference values are very large or change often.

Example

#[test]
fn test_hello_world() {
    insta::assert_debug_snapshot!(vec![1, 2, 3]);
}

Curious? There is a screencast that shows the entire workflow: watch the insta introduction screencast. Or if you're not into videos, read the one minute introduction.

Insta also supports inline snapshots which are stored right in your source file instead of separate files. This is accomplished by the companion cargo-insta tool.

Editor Support

For looking at

.snap
files there is a vscode extension which can syntax highlight snapshot files, review snapshots and more. It can be installed from the marketplace: view on marketplace.

jump to definition

Diffing

Insta uses

similar
for all its diffing operations. You can use it independently of insta.

License and Links

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.