mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
BREAKING: remove --allow-none
flag (#25337)
Towards #22079 Signed-off-by: Luca Casonato <hello@lcas.dev> Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
parent
e804175a0a
commit
f6eab6c4bd
5 changed files with 14 additions and 41 deletions
|
@ -390,7 +390,7 @@ pub struct TestFlags {
|
||||||
pub clean: bool,
|
pub clean: bool,
|
||||||
pub fail_fast: Option<NonZeroUsize>,
|
pub fail_fast: Option<NonZeroUsize>,
|
||||||
pub files: FileFlags,
|
pub files: FileFlags,
|
||||||
pub allow_none: bool,
|
pub permit_no_files: bool,
|
||||||
pub filter: Option<String>,
|
pub filter: Option<String>,
|
||||||
pub shuffle: Option<u64>,
|
pub shuffle: Option<u64>,
|
||||||
pub concurrent_jobs: Option<NonZeroUsize>,
|
pub concurrent_jobs: Option<NonZeroUsize>,
|
||||||
|
@ -2808,19 +2808,10 @@ Directory arguments are expanded to all contained files matching the glob
|
||||||
.value_name("N")
|
.value_name("N")
|
||||||
.value_parser(value_parser!(NonZeroUsize))
|
.value_parser(value_parser!(NonZeroUsize))
|
||||||
.help_heading(TEST_HEADING))
|
.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(
|
||||||
Arg::new("permit-no-files")
|
Arg::new("permit-no-files")
|
||||||
.long("permit-no-files")
|
.long("permit-no-files")
|
||||||
.help("Don't return an error code if no test files were found")
|
.help("Don't return an error code if no test files were found")
|
||||||
.conflicts_with("allow-none")
|
|
||||||
.action(ArgAction::SetTrue)
|
.action(ArgAction::SetTrue)
|
||||||
.help_heading(TEST_HEADING),
|
.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 trace_leaks = matches.get_flag("trace-leaks");
|
||||||
let doc = matches.get_flag("doc");
|
let doc = matches.get_flag("doc");
|
||||||
#[allow(clippy::print_stderr)]
|
#[allow(clippy::print_stderr)]
|
||||||
let allow_none = matches.get_flag("permit-no-files")
|
let permit_no_files = 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 filter = matches.remove_one::<String>("filter");
|
||||||
let clean = matches.get_flag("clean");
|
let clean = matches.get_flag("clean");
|
||||||
|
|
||||||
|
@ -4732,7 +4714,7 @@ fn test_parse(flags: &mut Flags, matches: &mut ArgMatches) {
|
||||||
files: FileFlags { include, ignore },
|
files: FileFlags { include, ignore },
|
||||||
filter,
|
filter,
|
||||||
shuffle,
|
shuffle,
|
||||||
allow_none,
|
permit_no_files,
|
||||||
concurrent_jobs,
|
concurrent_jobs,
|
||||||
trace_leaks,
|
trace_leaks,
|
||||||
watch: watch_arg_parse_with_paths(matches),
|
watch: watch_arg_parse_with_paths(matches),
|
||||||
|
@ -8484,7 +8466,7 @@ mod tests {
|
||||||
doc: false,
|
doc: false,
|
||||||
fail_fast: None,
|
fail_fast: None,
|
||||||
filter: Some("- foo".to_string()),
|
filter: Some("- foo".to_string()),
|
||||||
allow_none: true,
|
permit_no_files: true,
|
||||||
files: FileFlags {
|
files: FileFlags {
|
||||||
include: vec!["dir1/".to_string(), "dir2/".to_string()],
|
include: vec!["dir1/".to_string(), "dir2/".to_string()],
|
||||||
ignore: vec![],
|
ignore: vec![],
|
||||||
|
@ -8572,7 +8554,7 @@ mod tests {
|
||||||
doc: false,
|
doc: false,
|
||||||
fail_fast: Some(NonZeroUsize::new(3).unwrap()),
|
fail_fast: Some(NonZeroUsize::new(3).unwrap()),
|
||||||
filter: None,
|
filter: None,
|
||||||
allow_none: false,
|
permit_no_files: false,
|
||||||
shuffle: None,
|
shuffle: None,
|
||||||
files: FileFlags {
|
files: FileFlags {
|
||||||
include: vec![],
|
include: vec![],
|
||||||
|
@ -8615,7 +8597,7 @@ mod tests {
|
||||||
doc: false,
|
doc: false,
|
||||||
fail_fast: None,
|
fail_fast: None,
|
||||||
filter: None,
|
filter: None,
|
||||||
allow_none: false,
|
permit_no_files: false,
|
||||||
shuffle: None,
|
shuffle: None,
|
||||||
files: FileFlags {
|
files: FileFlags {
|
||||||
include: vec![],
|
include: vec![],
|
||||||
|
@ -8752,7 +8734,7 @@ mod tests {
|
||||||
doc: false,
|
doc: false,
|
||||||
fail_fast: None,
|
fail_fast: None,
|
||||||
filter: None,
|
filter: None,
|
||||||
allow_none: false,
|
permit_no_files: false,
|
||||||
shuffle: Some(1),
|
shuffle: Some(1),
|
||||||
files: FileFlags {
|
files: FileFlags {
|
||||||
include: vec![],
|
include: vec![],
|
||||||
|
@ -8788,7 +8770,7 @@ mod tests {
|
||||||
doc: false,
|
doc: false,
|
||||||
fail_fast: None,
|
fail_fast: None,
|
||||||
filter: None,
|
filter: None,
|
||||||
allow_none: false,
|
permit_no_files: false,
|
||||||
shuffle: None,
|
shuffle: None,
|
||||||
files: FileFlags {
|
files: FileFlags {
|
||||||
include: vec![],
|
include: vec![],
|
||||||
|
@ -8823,7 +8805,7 @@ mod tests {
|
||||||
doc: false,
|
doc: false,
|
||||||
fail_fast: None,
|
fail_fast: None,
|
||||||
filter: None,
|
filter: None,
|
||||||
allow_none: false,
|
permit_no_files: false,
|
||||||
shuffle: None,
|
shuffle: None,
|
||||||
files: FileFlags {
|
files: FileFlags {
|
||||||
include: vec!["./".to_string()],
|
include: vec!["./".to_string()],
|
||||||
|
@ -8860,7 +8842,7 @@ mod tests {
|
||||||
doc: false,
|
doc: false,
|
||||||
fail_fast: None,
|
fail_fast: None,
|
||||||
filter: None,
|
filter: None,
|
||||||
allow_none: false,
|
permit_no_files: false,
|
||||||
shuffle: None,
|
shuffle: None,
|
||||||
files: FileFlags {
|
files: FileFlags {
|
||||||
include: vec![],
|
include: vec![],
|
||||||
|
|
|
@ -369,7 +369,7 @@ pub struct WorkspaceTestOptions {
|
||||||
pub doc: bool,
|
pub doc: bool,
|
||||||
pub no_run: bool,
|
pub no_run: bool,
|
||||||
pub fail_fast: Option<NonZeroUsize>,
|
pub fail_fast: Option<NonZeroUsize>,
|
||||||
pub allow_none: bool,
|
pub permit_no_files: bool,
|
||||||
pub filter: Option<String>,
|
pub filter: Option<String>,
|
||||||
pub shuffle: Option<u64>,
|
pub shuffle: Option<u64>,
|
||||||
pub concurrent_jobs: NonZeroUsize,
|
pub concurrent_jobs: NonZeroUsize,
|
||||||
|
@ -382,7 +382,7 @@ pub struct WorkspaceTestOptions {
|
||||||
impl WorkspaceTestOptions {
|
impl WorkspaceTestOptions {
|
||||||
pub fn resolve(test_flags: &TestFlags) -> Self {
|
pub fn resolve(test_flags: &TestFlags) -> Self {
|
||||||
Self {
|
Self {
|
||||||
allow_none: test_flags.allow_none,
|
permit_no_files: test_flags.permit_no_files,
|
||||||
concurrent_jobs: test_flags
|
concurrent_jobs: test_flags
|
||||||
.concurrent_jobs
|
.concurrent_jobs
|
||||||
.unwrap_or_else(|| NonZeroUsize::new(1).unwrap()),
|
.unwrap_or_else(|| NonZeroUsize::new(1).unwrap()),
|
||||||
|
|
|
@ -1778,7 +1778,8 @@ pub async fn run_tests(
|
||||||
)
|
)
|
||||||
.await?;
|
.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"));
|
return Err(generic_error("No test modules found"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,6 @@
|
||||||
"args": "test --permit-no-files",
|
"args": "test --permit-no-files",
|
||||||
"output": "permit_no_files.out",
|
"output": "permit_no_files.out",
|
||||||
"exitCode": 0
|
"exitCode": 0
|
||||||
},
|
|
||||||
"allow_none": {
|
|
||||||
"args": "test --allow-none",
|
|
||||||
"output": "allow_none.out",
|
|
||||||
"exitCode": 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
|
||||||
|
|
Loading…
Reference in a new issue