-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
require_full_match mode always fails with matching snapshots #477
Comments
This is indeed a bug. We can work around it temporarily by changing the test name to something that insta doesn't change: diff --git a/src/lib.rs b/src/lib.rs
index 3f262aa..b23d00e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,7 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
- fn test_insta() {
- insta::assert_json_snapshot!(1+1);
+ fn insta() {
+ insta::assert_json_snapshot!(1 + 1);
}
} ...since it's caused by the name of the snapshot name being truncated, and so the metadata not matching. We can fix it by aligning name truncation to the metadata comparison.
|
There are a couple of other issues when calling |
Fixes mitsuhiko#401 as well as most (but not all) of mitsuhiko#477
This fixes the issues in mitsuhiko#477, stacked on mitsuhiko#483. It's possible I've still missed something -- I realize that there are plenty of areas I'm still unsure about in the repo. Possibly some slower integration tests with sample projects would be worthwhile; though they don't make for the nimblest of tests...
We can close this (though note caveat from #497) |
What happened?
When I run
INSTA_REQUIRE_FULL_MATCH=1 cargo test
on a dummy snapshot test case, it fails with the following output:Output
This is even though the expected output, as well as the expression match the snapshot file.
The normal
cargo test
snapshot test passes as expected.Reproduction steps
INSTA_REQUIRE_FULL_MATCH=1 cargo test
on this minimal reproducing example.Insta Version
cargo-insta 1.38.0
rustc Version
rustc 1.77.2 (25ef9e3d8 2024-04-09)
What did you expect?
The test should pass.
The text was updated successfully, but these errors were encountered: