Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simpler accept behavior on non-insta failures #358

Merged
merged 6 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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