mitsuhiko / insta

A snapshot testing library for rust
https://insta.rs
Apache License 2.0
2.07k stars 93 forks source link

`INSTA_UPDATE=always cargo test` with an incorrect inline snapshot passes #478

Open max-sixty opened 2 months ago

max-sixty commented 2 months ago

What happened?

with a test like:

    #[test]
    fn test_inline() {
        insta::assert_snapshot!(3 + 2, @"");
    }

... running INSTA_UPDATE=always cargo test gives:

error: cannot update inline snapshots in-place (https://github.com/mitsuhiko/insta/issues/272)
test tests::test_inline ... ok

But then returns a zero exit code

Arguably this should return a non-zero exit code, to indicate the snapshots are not correct

Reproduction steps

No response

Insta Version

1.38

rustc Version

1.77.2

What did you expect?

No response

mitsuhiko commented 1 month ago

I would like to fix this by implementing inline snapshot updates without the need of cargo-insta. See #490