diff options
author | Luca Casonato <hello@lcas.dev> | 2024-08-02 15:18:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-02 13:18:59 +0000 |
commit | 84ff4182652d55c52391542000d8bb3ad22a4935 (patch) | |
tree | 80664ddb88d85061b9ad7b5856cc6404597f2c9b /cli/args/flags.rs | |
parent | 124a13280e3d71ed14ef0899b7bfd012f82ceb6e (diff) |
feat(test): rename --allow-none to --permit-no-files (#24809)
Diffstat (limited to 'cli/args/flags.rs')
-rw-r--r-- | cli/args/flags.rs | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 75987e9d0..e8e363d79 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -2683,10 +2683,19 @@ Directory arguments are expanded to all contained files matching the glob .value_name("N") .value_parser(value_parser!(NonZeroUsize)), ) + // TODO(@lucacasonato): remove for Deno 2.0 .arg( Arg::new("allow-none") .long("allow-none") .help("Don't return error code if no test files are found") + .hide(true) + .action(ArgAction::SetTrue), + ) + .arg( + Arg::new("permit-no-files") + .long("permit-no-files") + .help("Don't return an error code if no test files were found") + .conflicts_with("allow-none") .action(ArgAction::SetTrue), ) .arg( @@ -4437,7 +4446,17 @@ fn test_parse(flags: &mut Flags, matches: &mut ArgMatches) { ); } let doc = matches.get_flag("doc"); - let allow_none = matches.get_flag("allow-none"); + #[allow(clippy::print_stderr)] + let allow_none = matches.get_flag("permit-no-files") + || if matches.get_flag("allow-none") { + eprintln!( + "⚠️ {}", + crate::colors::yellow("The `--allow-none` flag is deprecated and will be removed in Deno 2.0.\nUse the `--permit-no-files` flag instead."), + ); + true + } else { + false + }; let filter = matches.remove_one::<String>("filter"); let clean = matches.get_flag("clean"); @@ -8398,7 +8417,7 @@ mod tests { #[test] fn test_with_flags() { #[rustfmt::skip] - let r = flags_from_vec(svec!["deno", "test", "--unstable", "--no-npm", "--no-remote", "--trace-leaks", "--no-run", "--filter", "- foo", "--coverage=cov", "--clean", "--location", "https:foo", "--allow-net", "--allow-none", "dir1/", "dir2/", "--", "arg1", "arg2"]); + let r = flags_from_vec(svec!["deno", "test", "--unstable", "--no-npm", "--no-remote", "--trace-leaks", "--no-run", "--filter", "- foo", "--coverage=cov", "--clean", "--location", "https:foo", "--allow-net", "--permit-no-files", "dir1/", "dir2/", "--", "arg1", "arg2"]); assert_eq!( r.unwrap(), Flags { |