Skip to content

Commit

Permalink
Only pass --color if not always to work around custom runners (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed May 15, 2024
1 parent 58daea1 commit 65947be
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ All notable changes to insta and cargo-insta are documented here.
## 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

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

- Don't pass `--color` in all cases to `libtest` any more to work around limitations
with custom test harnesses. #491

## 1.38.0

- `Filters` is now constructible from `IntoIterator`. #400
Expand Down
10 changes: 5 additions & 5 deletions cargo-insta/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -954,11 +954,11 @@ fn prepare_test_runner<'snapshot_ref>(
// Currently libtest uses a different approach to color, so we need to pass
// it again to get output from the test runner as well as cargo. See
// https://github.com/rust-lang/cargo/issues/1983 for more
match test_runner {
TestRunner::CargoTest | TestRunner::Auto => {
proc.arg(format!("--color={}", color));
}
_ => {}
// We also only want to do this if we override auto as some custom test runners
// do not handle --color and then we at least fix the default case.
// https://github.com/mitsuhiko/insta/issues/473
if color != "auto" && matches!(test_runner, TestRunner::CargoTest | TestRunner::Auto) {
proc.arg(format!("--color={}", color));
};
Ok((proc, snapshot_ref_file, prevents_doc_run))
}
Expand Down

0 comments on commit 65947be

Please sign in to comment.