insta
insta copied to clipboard
Duplicated snapshots and os error 2 when running both integration and unit tests
What happened?
When running insta, I get duplicated snapshot reviews, as well as a crash at the end of the snapshot reviewing. In the original (non-minimal) case, I wasn't able to review some of my tests.
I should have reviewed two snapshots, but only was able to review one. The error was the dreaded "No such file or directory (os error 2)".
Reproduction steps
- Create a new directory (not using
cargo new --lib) - Create a
Cargo.toml - Put this in your
Cargo.toml:
[package]
name = "testing2"
version = "0.1.0"
[[test]]
name = "integration"
path = "tests/tests.rs"
[dev-dependencies]
insta = { workspace = true }
[workspace]
members = ["testing"]
[workspace.dependencies]
insta = "1.31"
- Run
cargo new testing --libin the project root - Put this in
testing/src/lib.rs
#[test]
fn it_works() {
insta::assert_snapshot!("stuff...");
}
- Create the
tests/directory in the project root - Create
tests/tests.rs - Put this in
tests/tests.rs
#[test]
fn works() {
insta::assert_snapshot!("hr");
}
- Run
cargo insta test --review --all
Insta Version
1.31.0
rustc Version
1.71.0
What did you expect?
I expected to review two tests, and have no crash.
I'm also struggling with this issue... I need to run things without --workspace, one-at-a-time, just to get insta to work!