Process 1: cargo insta test --accept -- test_foo is runs on every file change (e.g. with watchexec). test_foo passes fine.
Process 2: cargo insta test --accept is run manually. This finds an incorrect snapshot and creates a .snap.new file
Process 1: triggered by the file change, it re-runs its command on test_foo, test_foo passes fine again. It doesn't accept the .snap.new file because it's for an unrelated change. But it does remove it.
Process 2: completes, and would accept the change in .snap.new, but the file is gone. It doesn't raise an error.
So because we have two processes running, we've managed to run cargo insta test --accept, missed an incorrect snapshot, and yet every process has reported success.
Should we instead only remove additional .snap.new files when running cargo insta review? Unlike cargo insta test --accept, that's running over every .snap.new file; it can't delete ones that relate to other tests. cargo insta test --accept can still remove .snap.new files for the tests it's running, but wouldn't for other tests.
Currently we can get the following sequence:
cargo insta test --accept -- test_foo
is runs on every file change (e.g. withwatchexec
).test_foo
passes fine.cargo insta test --accept
is run manually. This finds an incorrect snapshot and creates a.snap.new
filetest_foo
,test_foo
passes fine again. It doesn't accept the.snap.new
file because it's for an unrelated change. But it does remove it..snap.new
, but the file is gone. It doesn't raise an error.So because we have two processes running, we've managed to run
cargo insta test --accept
, missed an incorrect snapshot, and yet every process has reported success.Should we instead only remove additional
.snap.new
files when runningcargo insta review
? Unlikecargo insta test --accept
, that's running over every.snap.new
file; it can't delete ones that relate to other tests.cargo insta test --accept
can still remove.snap.new
files for the tests it's running, but wouldn't for other tests.