Skip to content

Commit

Permalink
fix setting default-true flags to false (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfrankland authored Dec 9, 2024
1 parent 104f48c commit 9e7443f
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cli-tests/src/upload.rs
Original file line number Diff line number Diff line change
@@ -324,6 +324,8 @@ async fn upload_bundle_no_files_allow_missing_junit_files() {
}
};

args.push("--print-files");

let mut assert = Command::new(CARGO_RUN.path())
.current_dir(&temp_dir)
.env("TRUNK_PUBLIC_API_ADDRESS", &state.host)
@@ -340,7 +342,14 @@ async fn upload_bundle_no_files_allow_missing_junit_files() {
assert.success()
};

assert = assert.stderr(predicate::str::contains("unexpected argument").not());
let predicate_fn = predicate::str::contains("unexpected argument");

// `=` is required to set the flag to `false`
assert = if matches!(flag, Flag::Off | Flag::OffAlias) {
assert.stderr(predicate_fn)
} else {
assert.stderr(predicate_fn.not())
};

// HINT: View CLI output with `cargo test -- --nocapture`
println!("{assert}");
2 changes: 2 additions & 0 deletions cli/src/upload.rs
Original file line number Diff line number Diff line change
@@ -88,6 +88,7 @@ pub struct UploadArgs {
help = "Run commands with the quarantining step.",
action = ArgAction::Set,
required = false,
require_equals = true,
num_args = 0..=1,
default_value = "true",
default_missing_value = "true",
@@ -99,6 +100,7 @@ pub struct UploadArgs {
help = "Do not fail if test results are not found.",
action = ArgAction::Set,
required = false,
require_equals = true,
num_args = 0..=1,
default_value = "true",
default_missing_value = "true",

0 comments on commit 9e7443f

Please sign in to comment.