Skip to content

Commit

Permalink
Only pass --color if not always to work around custom runners
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed May 15, 2024
1 parent 58daea1 commit 2e0ba4d
Showing 1 changed file with 5 additions and 5 deletions.
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 2e0ba4d

Please sign in to comment.