Skip to content

Commit

Permalink
Simpler accept behavior on non-insta failures (#358)
Browse files Browse the repository at this point in the history
* Simpler accept behavior on non-insta failures

I wasn't sure how deliberate this choice was -- totally fine to close if it was. As a user, I always want it to honor the `--accept` arg.

* Update CHANGELOG.md

---------

Co-authored-by: Armin Ronacher <armin.ronacher@active-4.com>
  • Loading branch information
max-sixty and mitsuhiko authored Jun 16, 2023
1 parent 362eb95 commit a0fea38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ All notable changes to insta and cargo-insta are documented here.

## 1.30.0

- Snapshots are accepted when running with `--accept` even if a test outside
insta fails. (#358)
- Mark settings drop guard as `#[must_use]`.
- Write inline snapshots with atomic rename to avoid some rare races. (#373)
- Pass `--color=...` to libtest to propagate color choices in more situations. (#375)

## 1.29.0

- Fixed a rednering bug with snapshot display (lines were not
- Fixed a rendering bug with snapshot display (lines were not
rendered to the terminal width).
- Added `--exclude` option to `cargo insta test`. (#360)
- Inherit `color` option from a `CARGO_TERM_COLOR` environment variable (#361)
Expand Down
17 changes: 5 additions & 12 deletions cargo-insta/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,18 +605,11 @@ fn test_run(mut cmd: TestCommand, color: &str) -> Result<(), Box<dyn Error>> {
success = success && proc.status()?.success();
}

if !success {
if cmd.review {
eprintln!(
"{} non snapshot tests failed, skipping review",
style("warning:").bold().yellow()
);
} else if cmd.accept {
eprintln!(
"{} non snapshot tests failed, not accepted changes",
style("warning:").bold().yellow()
);
}
if !success && cmd.review {
eprintln!(
"{} non snapshot tests failed, skipping review",
style("warning:").bold().yellow()
);
return Err(QuietExit(1).into());
}

Expand Down

0 comments on commit a0fea38

Please sign in to comment.