diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/args/flags.rs | 62 | ||||
-rw-r--r-- | cli/tests/check_tests.rs | 2 | ||||
-rw-r--r-- | cli/tests/npm_tests.rs | 8 |
3 files changed, 41 insertions, 31 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 829051bce..4296fbc77 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -797,13 +797,21 @@ Future runs of this module will trigger no downloads or compilation unless \ fn check_subcommand<'a>() -> Command<'a> { compile_args_without_check_args(Command::new("check")) - .arg( - Arg::new("remote") - .long("remote") - .help("Type-check all modules, including remote") - .conflicts_with("no-remote") + .arg( + Arg::new("all") + .long("all") + .help("Type-check all code, including remote modules and npm packages") + .conflicts_with("no-remote") ) .arg( + // past alias for --all + Arg::new("remote") + .long("remote") + .help("Type-check all modules, including remote") + .conflicts_with("no-remote") + .hide(true) + ) + .arg( Arg::new("file") .takes_value(true) .required(true) @@ -2343,7 +2351,7 @@ fn check_parse(flags: &mut Flags, matches: &clap::ArgMatches) { .unwrap() .map(String::from) .collect(); - if matches.is_present("remote") { + if matches.is_present("all") || matches.is_present("remote") { flags.type_check_mode = TypeCheckMode::All; } flags.subcommand = DenoSubcommand::Check(CheckFlags { files }); @@ -4001,26 +4009,28 @@ mod tests { } ); - let r = flags_from_vec(svec!["deno", "check", "--remote", "script.ts"]); - assert_eq!( - r.unwrap(), - Flags { - subcommand: DenoSubcommand::Check(CheckFlags { - files: svec!["script.ts"], - }), - type_check_mode: TypeCheckMode::All, - ..Flags::default() - } - ); - - let r = flags_from_vec(svec![ - "deno", - "check", - "--remote", - "--no-remote", - "script.ts" - ]); - assert_eq!(r.unwrap_err().kind(), clap::ErrorKind::ArgumentConflict); + for all_flag in ["--remote", "--all"] { + let r = flags_from_vec(svec!["deno", "check", all_flag, "script.ts"]); + assert_eq!( + r.unwrap(), + Flags { + subcommand: DenoSubcommand::Check(CheckFlags { + files: svec!["script.ts"], + }), + type_check_mode: TypeCheckMode::All, + ..Flags::default() + } + ); + + let r = flags_from_vec(svec![ + "deno", + "check", + all_flag, + "--no-remote", + "script.ts" + ]); + assert_eq!(r.unwrap_err().kind(), clap::ErrorKind::ArgumentConflict); + } } #[test] diff --git a/cli/tests/check_tests.rs b/cli/tests/check_tests.rs index 3a57c3f55..54f9cc272 100644 --- a/cli/tests/check_tests.rs +++ b/cli/tests/check_tests.rs @@ -28,7 +28,7 @@ mod check { }); itest!(check_all { - args: "check --quiet --remote check/check_all.ts", + args: "check --quiet --all check/check_all.ts", output: "check/check_all.out", http_server: true, exit_code: 1, diff --git a/cli/tests/npm_tests.rs b/cli/tests/npm_tests.rs index 61b2dc886..05dc83cfd 100644 --- a/cli/tests/npm_tests.rs +++ b/cli/tests/npm_tests.rs @@ -264,7 +264,7 @@ mod npm { }); itest!(check_all { - args: "check --remote npm/check_errors/main.ts", + args: "check --all npm/check_errors/main.ts", output: "npm/check_errors/main_all.out", envs: env_vars_for_npm_tests(), http_server: true, @@ -320,7 +320,7 @@ mod npm { }); itest!(types_entry_value_not_exists { - args: "check --remote npm/types_entry_value_not_exists/main.ts", + args: "check --all npm/types_entry_value_not_exists/main.ts", output: "npm/types_entry_value_not_exists/main.out", envs: env_vars_for_npm_tests(), http_server: true, @@ -328,7 +328,7 @@ mod npm { }); itest!(types_exports_import_types { - args: "check --remote npm/types_exports_import_types/main.ts", + args: "check --all npm/types_exports_import_types/main.ts", output: "npm/types_exports_import_types/main.out", envs: env_vars_for_npm_tests(), http_server: true, @@ -336,7 +336,7 @@ mod npm { }); itest!(types_no_types_entry { - args: "check --remote npm/types_no_types_entry/main.ts", + args: "check --all npm/types_no_types_entry/main.ts", output: "npm/types_no_types_entry/main.out", envs: env_vars_for_npm_tests(), http_server: true, |