1
0
Fork 0
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:
Asher Gomez 2024-09-03 08:06:27 +10:00 committed by GitHub
parent e804175a0a
commit f6eab6c4bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 41 deletions

View file

@ -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![],

View file

@ -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()),

View file

@ -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"));
}

View file

@ -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
}
}
}

View file

@ -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)