You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently when a snapshots needs updating, cargo insta test doesn't show a diff, only:
info: 1 snapshot to review
use `cargo insta review` to review snapshots
[Command exited with 1]
Seeing a diff can be really useful — for example, I often run tests on any file change, and being able to view the diff while adjusting code allows for really fast feedback.
To see a diff, we instead need to run cargo insta test --check. But this has some disadvantages:
It doesn't write pending snapshots
It exits early when it encounters the first error
It requires switching commands — when watchexec -- cargo insta test --check is running, we then need to exit and change to cargo insta test --accept when we want to accept the snapshot
(another approach is running cargo insta test --accept in the loop and viewing the diff in git — but because the test passes, we don't get any debug output, and it requires another watch process to update the git diff)
Should we show the diff when running cargo insta test? The downside is that the diff can be huge, and so could potentially overwhelm a terminal. One option would be to print some of a diff, and then print "limiting diff output to 300 lines, run cargo insta --check for a full output, or cargo insta review to review each diff"
The text was updated successfully, but these errors were encountered:
Currently when a snapshots needs updating,
cargo insta test
doesn't show a diff, only:Seeing a diff can be really useful — for example, I often run tests on any file change, and being able to view the diff while adjusting code allows for really fast feedback.
To see a diff, we instead need to run
cargo insta test --check
. But this has some disadvantages:watchexec -- cargo insta test --check
is running, we then need to exit and change tocargo insta test --accept
when we want to accept the snapshotcargo insta test --accept
in the loop and viewing the diff in git — but because the test passes, we don't get any debug output, and it requires another watch process to update the git diff)Should we show the diff when running
cargo insta test
? The downside is that the diff can be huge, and so could potentially overwhelm a terminal. One option would be to print some of a diff, and then print "limiting diff output to 300 lines, runcargo insta --check
for a full output, orcargo insta review
to review each diff"The text was updated successfully, but these errors were encountered: