-
-
Notifications
You must be signed in to change notification settings - Fork 103
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 a workspace + root crate #396
Comments
I'm also struggling with this issue... I need to run things without |
Same here, which makes |
I've added some better error messages on missing files, currently only on master. Could folks try that and see what that reports? (I'm not familiar with insta not working on larger workspaces; we use it very successfully in PRQL. Is the distinction that nested crates have problems?) |
[patch.crates-io]
insta = { git = "https://github.com/mitsuhiko/insta.git", branch = "master" } @max-sixty no difference, still only getting this:
The workspace consists of a root bin package and 9 member lib crates, two of which contain the snapshot tests. Running Curiously running the |
Would you mind trying (There may be an error source which doesn't offer more info. But I at least more info to some sources, including ones that look like this)
Thanks — I guess this is because of the root / nested package. I'm guessing if turn the root package off then it works OK (to the extent that's possible to test)? |
Now it does indeed provide a more useful error message:
I deleted the contents of the
Commenting out |
OK nice, that's some progress. I had a look through the code — I can't see exactly what's going on. I think two main possibilities:
Could we try renaming the test that references Also if anyone has a minimally reproducible example — probably requires a link to a repo — that would be v useful... |
This is all you need: Workspace with root package and single snapshot test in member crate. 💣💥
As evident from the stdout/stderr output above the issue doesn't seem to be related to name collisions among workspace crates, since even adding a single test to a single member crate triggers the error. The error however only gets triggered if the workspace also has a root package (that doesn't need to actively be using |
@regexident thanks for the full example! I obv fully believe it happens. Weirdly I can't repro locally — I'm guessing it's something about the order in which the crates run. I haven't tried your exact example — would you be able to push it as a git repo? Otherwise I can copy & paste the files. |
Here is a repository: insta-bug-repro.zip I've added a commit (with explanatory messages) for each of the steps described above and added ✅/❌ for the expected outcome of running Make sure to delete the snapshot directory in between runs. |
I'm running the following in case it helps:
|
Thank you! I can repro with (+ ref #388, I think likely related) |
Great @regexident , if you get a moment, would you mind testing whether #531 works? Otherwise we can presume it does; it solves your (excellent!) MCVE
|
@max-sixty Just gave it a few test runs and got no errors. Awesome! Thanks for looking into the issue! 🙏 |
Fixed by #532 |
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
cargo new --lib
)Cargo.toml
Cargo.toml
:cargo new testing --lib
in the project roottesting/src/lib.rs
tests/
directory in the project roottests/tests.rs
tests/tests.rs
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.
The text was updated successfully, but these errors were encountered: