diff options
-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 | ||||
-rw-r--r-- | tests/specs/test/no_files/__test__.jsonc | 5 | ||||
-rw-r--r-- | tests/specs/test/no_files/allow_none.out | 5 |
5 files changed, 14 insertions, 41 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")); } diff --git a/tests/specs/test/no_files/__test__.jsonc b/tests/specs/test/no_files/__test__.jsonc index 0bb252ec7..3440a4907 100644 --- a/tests/specs/test/no_files/__test__.jsonc +++ b/tests/specs/test/no_files/__test__.jsonc @@ -9,11 +9,6 @@ "args": "test --permit-no-files", "output": "permit_no_files.out", "exitCode": 0 - }, - "allow_none": { - "args": "test --allow-none", - "output": "allow_none.out", - "exitCode": 0 } } } diff --git a/tests/specs/test/no_files/allow_none.out b/tests/specs/test/no_files/allow_none.out deleted file mode 100644 index 1cc973bb5..000000000 --- a/tests/specs/test/no_files/allow_none.out +++ /dev/null @@ -1,5 +0,0 @@ -⚠️ The `--allow-none` flag is deprecated and will be removed in Deno 2.0. -Use the `--permit-no-files` flag instead. - -ok | 0 passed | 0 failed (0ms) - |