diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-09-03 08:06:27 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-02 22:06:27 +0000 |
commit | f6eab6c4bd7a8bba35f13fd353ac319625373553 (patch) | |
tree | 27ef4187353b42c1ab4c60f4d69806a350b4a8e0 /cli | |
parent | e804175a0ad850f09086b70368042ac50cee116e (diff) |
BREAKING: remove `--allow-none` flag (#25337)
Towards #22079
Signed-off-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: Luca Casonato <hello@lcas.dev>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/args/flags.rs | 38 | ||||
-rw-r--r-- | cli/args/mod.rs | 4 | ||||
-rw-r--r-- | cli/tools/test/mod.rs | 3 |
3 files changed, 14 insertions, 31 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 86f992e99..9e50ccc49 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -390,7 +390,7 @@ pub struct TestFlags { pub clean: bool, pub fail_fast: Option<NonZeroUsize>, pub files: FileFlags, - pub allow_none: bool, + pub permit_no_files: bool, pub filter: Option<String>, pub shuffle: Option<u64>, pub concurrent_jobs: Option<NonZeroUsize>, @@ -2808,19 +2808,10 @@ Directory arguments are expanded to all contained files matching the glob .value_name("N") .value_parser(value_parser!(NonZeroUsize)) .help_heading(TEST_HEADING)) - // 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) .help_heading(TEST_HEADING), ) @@ -4657,16 +4648,7 @@ fn test_parse(flags: &mut Flags, matches: &mut ArgMatches) { let trace_leaks = matches.get_flag("trace-leaks"); let doc = matches.get_flag("doc"); #[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 permit_no_files = matches.get_flag("permit-no-files"); let filter = matches.remove_one::<String>("filter"); let clean = matches.get_flag("clean"); @@ -4732,7 +4714,7 @@ fn test_parse(flags: &mut Flags, matches: &mut ArgMatches) { files: FileFlags { include, ignore }, filter, shuffle, - allow_none, + permit_no_files, concurrent_jobs, trace_leaks, watch: watch_arg_parse_with_paths(matches), @@ -8484,7 +8466,7 @@ mod tests { doc: false, fail_fast: None, filter: Some("- foo".to_string()), - allow_none: true, + permit_no_files: true, files: FileFlags { include: vec!["dir1/".to_string(), "dir2/".to_string()], ignore: vec![], @@ -8572,7 +8554,7 @@ mod tests { doc: false, fail_fast: Some(NonZeroUsize::new(3).unwrap()), filter: None, - allow_none: false, + permit_no_files: false, shuffle: None, files: FileFlags { include: vec![], @@ -8615,7 +8597,7 @@ mod tests { doc: false, fail_fast: None, filter: None, - allow_none: false, + permit_no_files: false, shuffle: None, files: FileFlags { include: vec![], @@ -8752,7 +8734,7 @@ mod tests { doc: false, fail_fast: None, filter: None, - allow_none: false, + permit_no_files: false, shuffle: Some(1), files: FileFlags { include: vec![], @@ -8788,7 +8770,7 @@ mod tests { doc: false, fail_fast: None, filter: None, - allow_none: false, + permit_no_files: false, shuffle: None, files: FileFlags { include: vec![], @@ -8823,7 +8805,7 @@ mod tests { doc: false, fail_fast: None, filter: None, - allow_none: false, + permit_no_files: false, shuffle: None, files: FileFlags { include: vec!["./".to_string()], @@ -8860,7 +8842,7 @@ mod tests { doc: false, fail_fast: None, filter: None, - allow_none: false, + permit_no_files: false, shuffle: None, files: FileFlags { include: vec![], diff --git a/cli/args/mod.rs b/cli/args/mod.rs index aed5bc1b2..50132b1fb 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -369,7 +369,7 @@ pub struct WorkspaceTestOptions { pub doc: bool, pub no_run: bool, pub fail_fast: Option<NonZeroUsize>, - pub allow_none: bool, + pub permit_no_files: bool, pub filter: Option<String>, pub shuffle: Option<u64>, pub concurrent_jobs: NonZeroUsize, @@ -382,7 +382,7 @@ pub struct WorkspaceTestOptions { impl WorkspaceTestOptions { pub fn resolve(test_flags: &TestFlags) -> Self { Self { - allow_none: test_flags.allow_none, + permit_no_files: test_flags.permit_no_files, concurrent_jobs: test_flags .concurrent_jobs .unwrap_or_else(|| NonZeroUsize::new(1).unwrap()), diff --git a/cli/tools/test/mod.rs b/cli/tools/test/mod.rs index 0dc213350..7b172cf87 100644 --- a/cli/tools/test/mod.rs +++ b/cli/tools/test/mod.rs @@ -1778,7 +1778,8 @@ pub async fn run_tests( ) .await?; - if !workspace_test_options.allow_none && specifiers_with_mode.is_empty() { + if !workspace_test_options.permit_no_files && specifiers_with_mode.is_empty() + { return Err(generic_error("No test modules found")); } |