Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cargo-insta/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ struct TestCommand {
long = "test-runner-fallback",
num_args(0..=1),
default_missing_value = "true",
require_equals = true,
overrides_with = "_no_test_runner_fallback"
)]
test_runner_fallback: Option<bool>,
Expand Down
31 changes: 31 additions & 0 deletions cargo-insta/tests/functional/test_runner_fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,37 @@ fn test_snapshot() {
);
}

/// Test that --test-runner-fallback true (with space) enables fallback (backward compatibility)
#[test]
fn test_runner_fallback_space_true() {
let test_project = TestFiles::new()
.add_cargo_toml("test_runner_fallback_space_true")
.add_file(
"src/lib.rs",
r#"
#[test]
fn test_snapshot() {
insta::assert_snapshot!("value", @"value");
}
"#
.to_string(),
)
.create_project();

// Run with --test-runner-fallback true (space syntax, backward compatibility)
let output = test_project
.insta_cmd()
.args(["test", "--test-runner-fallback", "true"])
.output()
.unwrap();

assert!(
output.status.success(),
"Test should succeed with --test-runner-fallback true\nstderr: {}",
String::from_utf8_lossy(&output.stderr)
);
}

/// Test that --no-test-runner-fallback disables fallback
#[test]
fn test_no_test_runner_fallback_flag() {
Expand Down