From 527aed70c5b7ba5b6780bb7aaa604550ed01bc62 Mon Sep 17 00:00:00 2001 From: Maximilian Roos <5635139+max-sixty@users.noreply.github.com> Date: Fri, 2 Aug 2024 09:11:36 -0700 Subject: [PATCH] Fix `test_runner` in config (#544) --- cargo-insta/src/cli.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cargo-insta/src/cli.rs b/cargo-insta/src/cli.rs index 5401af2d..6b17827a 100644 --- a/cargo-insta/src/cli.rs +++ b/cargo-insta/src/cli.rs @@ -610,8 +610,15 @@ fn test_run(mut cmd: TestCommand, color: ColorWhen) -> Result<(), Box cmd.unreferenced = UnreferencedSnapshots::Delete; } + // Prioritize the command line over the tool config + let test_runner = match cmd.test_runner { + TestRunner::Auto => loc.tool_config.test_runner(), + TestRunner::CargoTest => TestRunner::CargoTest, + TestRunner::Nextest => TestRunner::Nextest, + }; + let (mut proc, snapshot_ref_file, prevents_doc_run) = - prepare_test_runner(cmd.test_runner, cmd.unreferenced, &cmd, color, &[], None)?; + prepare_test_runner(test_runner, cmd.unreferenced, &cmd, color, &[], None)?; if !cmd.keep_pending { process_snapshots(true, None, &loc, Some(Operation::Reject))?;