Skip to content

Commit

Permalink
Deprecate --no-force-pass
Browse files Browse the repository at this point in the history
This seems like a confusing option, and is dominated by the much clearer `--check`
  • Loading branch information
max-sixty committed Jun 26, 2024
1 parent 569bbad commit 1d1759d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

All notable changes to insta and cargo-insta are documented here.

## 1.40.0

- Deprecate `--no-force-pass` in `cargo-insta`. The `--check` option covers the
same functionality and has a clearer name.

## 1.39.0

- Fixed a bug in `require_full_match`. #485

- Fixed a bug that caused snapshot and module names to sometimes be inaccurate. #483

- Insta will no longer error when removing snapshots that were already removed. #484
- Insta will no longer error when attempting to remove snapshots that were already removed. #484

- Added support for trailing commas in inline snapshots. #472

Expand Down
9 changes: 7 additions & 2 deletions cargo-insta/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ struct TestCommand {
/// Exclude packages from the test
#[structopt(long, value_name = "SPEC")]
exclude: Option<String>,
/// Disable force-passing of snapshot tests
#[structopt(long)]
/// [Deprecated] Disable force-passing of snapshot tests
#[structopt(long, hidden = true)]
no_force_pass: bool,
/// Prevent running all tests regardless of failure
#[structopt(long)]
Expand Down Expand Up @@ -876,6 +876,11 @@ fn prepare_test_runner<'snapshot_ref>(
}
if !cmd.no_force_pass {
proc.env("INSTA_FORCE_PASS", "1");
} else {
eprintln!(
"{}: `--no-force-pass` is deprecated. Please use --check to immediately raise an error on any non-matching snapshots.",
style("warning").bold().yellow()
);
}
proc.env(
"INSTA_UPDATE",
Expand Down
2 changes: 1 addition & 1 deletion insta/tests/test_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ mod nested {
fn test_trailing_commas() {
assert_snapshot!("Testing",);
assert_snapshot!("Testing", "name",);
assert_snapshot!("Testing", "name", "expr",);
assert_snapshot!("Teting", "name", "exr",);
#[cfg(feature = "yaml")]
assert_yaml_snapshot!(vec![1, 2, 3, 4, 5],);
}
Expand Down

0 comments on commit 1d1759d

Please sign in to comment.