feat(test): add default to --coverage option (#21510)

This commit is contained in:
Yoshiya Hinosawa 2023-12-08 17:35:42 +09:00 committed by GitHub
parent d68d1e2022
commit 2b3daa690d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2161,12 +2161,14 @@ Directory arguments are expanded to all contained files matching the glob
.arg(
Arg::new("coverage")
.long("coverage")
.require_equals(true)
.value_name("DIR")
.num_args(0..=1)
.require_equals(true)
.default_missing_value("coverage")
.conflicts_with("inspect")
.conflicts_with("inspect-wait")
.conflicts_with("inspect-brk")
.help("Collect coverage profile data into DIR"),
.help("Collect coverage profile data into DIR. If DIR is not specified, it uses 'coverage/'."),
)
.arg(
Arg::new("parallel")
@ -7436,6 +7438,23 @@ mod tests {
);
}
#[test]
fn test_coverage_default_dir() {
let r = flags_from_vec(svec!["deno", "test", "--coverage"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Test(TestFlags {
coverage_dir: Some("coverage".to_string()),
..TestFlags::default()
}),
type_check_mode: TypeCheckMode::Local,
no_prompt: true,
..Flags::default()
}
);
}
#[test]
fn bundle_with_cafile() {
let r = flags_from_vec(svec![