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

cargo insta test does not find new snapshots #314

Closed
lu-zero opened this issue Dec 6, 2022 · 5 comments
Closed

cargo insta test does not find new snapshots #314

lu-zero opened this issue Dec 6, 2022 · 5 comments

Comments

@lu-zero
Copy link

lu-zero commented Dec 6, 2022

What happened?

I'm moving rust-code-analysis to insta from the custom system it uses.

If I do not use set_snapshot_path, it correctly produces the snapshots:

info: 1047 snapshots to review
use `cargo insta review` to review snapshots

If I pass set_snapshot_path("repositories/rca-output/snapshots") to fit the previous layout, it cannot find the new snapshots even if it prints stored new snapshot as before.

Reproduction steps

  1. Checkout Use insta mozilla/rust-code-analysis#953
  2. cargo insta test
  3. confirm it works as intended
  4. Uncomment in tests/test.rs settings.set_snapshot_path("repositories/rca-output/snapshots");
  5. no snapshots found and cargo test fails.

Insta Version

1.22.0

rustc Version

1.65.0

What did you expect?

cargo insta saving the snapshots in the right path and using it.

@lu-zero lu-zero added the bug Something isn't working label Dec 6, 2022
@mitsuhiko
Copy link
Owner

Any chance the path where the snapshots are located is referenced by .gitignore or another ignore file that is referenced?

@lu-zero
Copy link
Author

lu-zero commented Dec 7, 2022

You are spot on, that's the case.

@mitsuhiko
Copy link
Owner

mitsuhiko commented Dec 7, 2022

@lu-zero you can use cargo insta review --no-ignore to disable that behavior. Not sure if more should be done here (eg: maybe warn about skipped files?)

@mitsuhiko mitsuhiko removed the bug Something isn't working label Dec 7, 2022
@lu-zero
Copy link
Author

lu-zero commented Dec 7, 2022

Adding a warning sounds a good idea, maybe you could have an .insta.toml to set the default behavior

@mitsuhiko
Copy link
Owner

For insta toml see #282

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants