Skip to content

Commit

Permalink
Mention cargo insta test in assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Mar 26, 2022
1 parent 81b9a4b commit d80987d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to insta and cargo-insta are documented here.
moved since the time of the snapshot creation. (#220)
- `cargo insta test` now returns non zero status code when snapshots
are left for review. (#222)
- Assertion failures now mention `cargo insta test`. (#223)

## 1.13.0

Expand Down
9 changes: 9 additions & 0 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,15 @@ fn finalize_assertion(ctx: &SnapshotAssertionContext, update_result: SnapshotUpd
}

if update_result != SnapshotUpdate::InPlace && !force_pass() {
if get_output_behavior() != OutputBehavior::Nothing {
println!(
"{hint}",
hint = style(
"Stopped on the first failure. Run `cargo insta test` to run all snapshots."
)
.dim(),
);
}
panic!(
"snapshot assertion for '{}' failed in line {}",
ctx.snapshot_name
Expand Down

0 comments on commit d80987d

Please sign in to comment.