Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated snapshots and os error 2 when running both integration and unit tests #396

Open
dzfrias opened this issue Jul 29, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@dzfrias
Copy link

dzfrias commented Jul 29, 2023

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

  1. Create a new directory (not using cargo new --lib)
  2. Create a Cargo.toml
  3. 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"
  1. Run cargo new testing --lib in the project root
  2. Put this in testing/src/lib.rs
#[test]
fn it_works() {
    insta::assert_snapshot!("stuff...");
}
  1. Create the tests/ directory in the project root
  2. Create tests/tests.rs
  3. Put this in tests/tests.rs
#[test]
fn works() {
    insta::assert_snapshot!("hr");
}
  1. 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.

@dzfrias dzfrias added the bug Something isn't working label Jul 29, 2023
@TheLostLambda
Copy link

I'm also struggling with this issue... I need to run things without --workspace, one-at-a-time, just to get insta to work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants