mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
feat(flags): add deno check --all
as new preferred alias for --remote
(#16702)
Closes #16374
This commit is contained in:
parent
9c1ab39e19
commit
192f07bb7e
4 changed files with 46 additions and 36 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -1224,9 +1224,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_task_shell"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8ee71b861a4b9ad21e4a9fa4136bc1900fe6216115b439220ce3df9cc987403"
|
||||
checksum = "532b383a071a05144c712614d62f08a2f9fad48dd62d6d457ed3884b049357da"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"futures",
|
||||
|
@ -4802,9 +4802,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.15.2"
|
||||
version = "0.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7b3e525a49ec206798b40326a44121291b530c963cfb01018f63e135bac543d"
|
||||
checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16"
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
|
@ -5155,9 +5155,9 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
|
|||
|
||||
[[package]]
|
||||
name = "trybuild"
|
||||
version = "1.0.71"
|
||||
version = "1.0.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea496675d71016e9bc76aa42d87f16aefd95447cc5818e671e12b2d7e269075d"
|
||||
checksum = "db29f438342820400f2d9acfec0d363e987a38b2950bdb50a7069ed17b2148ee"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"once_cell",
|
||||
|
|
|
@ -797,12 +797,20 @@ 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)
|
||||
|
@ -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()
|
||||
}
|
||||
);
|
||||
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",
|
||||
"--remote",
|
||||
"--no-remote",
|
||||
"script.ts"
|
||||
]);
|
||||
assert_eq!(r.unwrap_err().kind(), clap::ErrorKind::ArgumentConflict);
|
||||
let r = flags_from_vec(svec![
|
||||
"deno",
|
||||
"check",
|
||||
all_flag,
|
||||
"--no-remote",
|
||||
"script.ts"
|
||||
]);
|
||||
assert_eq!(r.unwrap_err().kind(), clap::ErrorKind::ArgumentConflict);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue