0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-29 08:58:01 -04:00

fix(deno info): Never type check (#6978)

This commit is contained in:
Nayeem Rahman 2020-08-07 21:46:54 +01:00 committed by GitHub
parent 41215eb29c
commit 479164d287
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 3 deletions

View file

@ -468,7 +468,7 @@ fn info_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
ca_file_arg_parse(flags, matches);
unstable_arg_parse(flags, matches);
let json = matches.is_present("json");
no_check_arg_parse(flags, matches);
flags.no_check = true;
flags.subcommand = DenoSubcommand::Info {
file: matches.value_of("file").map(|f| f.to_string()),
json,
@ -849,7 +849,10 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.",
)
.arg(Arg::with_name("file").takes_value(true).required(false))
.arg(ca_file_arg())
.arg(no_check_arg())
// TODO(nayeemrmn): `--no-check` has been removed for `deno info`, but it
// shouldn't cause flag parsing to fail for backward-compatibility. Remove
// this line for v2.0.0.
.arg(no_check_arg().hidden(true))
.arg(unstable_arg())
.arg(
Arg::with_name("json")
@ -1832,6 +1835,7 @@ mod tests {
json: false,
file: Some("script.ts".to_string()),
},
no_check: true,
..Flags::default()
}
);
@ -1844,6 +1848,7 @@ mod tests {
json: true,
file: Some("script.ts".to_string()),
},
no_check: true,
..Flags::default()
}
);
@ -1856,6 +1861,7 @@ mod tests {
json: false,
file: None
},
no_check: true,
..Flags::default()
}
);
@ -1868,6 +1874,7 @@ mod tests {
json: true,
file: None
},
no_check: true,
..Flags::default()
}
);
@ -2573,6 +2580,50 @@ mod tests {
..Flags::default()
}
);
let r =
flags_from_vec_safe(svec!["deno", "test", "--no-check", "script.ts"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Test {
fail_fast: false,
filter: None,
allow_none: false,
quiet: false,
include: Some(svec!["script.ts"]),
},
no_check: true,
..Flags::default()
}
);
let r =
flags_from_vec_safe(svec!["deno", "cache", "--no-check", "script.ts"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Cache {
files: svec!["script.ts"],
},
no_check: true,
..Flags::default()
}
);
// TODO(nayeemrmn): `--no-check` has been removed for `deno info`, but it
// shouldn't cause flag parsing to fail for backward-compatibility. Remove
// this test for v2.0.0.
let r =
flags_from_vec_safe(svec!["deno", "info", "--no-check", "script.ts"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Info {
json: false,
file: Some("script.ts".to_string()),
},
no_check: true,
..Flags::default()
}
);
}
#[test]
@ -2893,6 +2944,7 @@ mod tests {
file: Some("https://example.com".to_string()),
},
ca_file: Some("example.crt".to_owned()),
no_check: true,
..Flags::default()
}
);

View file

@ -0,0 +1,6 @@
[WILDCARD]
local: [WILDCARD]031_info_no_check.ts
type: TypeScript
compiled: [WILDCARD].js
deps:
[WILDCARD]031_info_no_check.ts

View file

@ -0,0 +1 @@
const _foo: string = 1;

View file

@ -1454,6 +1454,12 @@ itest!(_030_eval_ts {
output: "030_eval_ts.out",
});
itest!(_031_info_no_check {
args: "info 031_info_no_check.ts",
output: "031_info_no_check.out",
http_server: true,
});
itest!(_033_import_map {
args:
"run --quiet --reload --importmap=importmaps/import_map.json --unstable importmaps/test.ts",
@ -1547,7 +1553,10 @@ itest!(_048_media_types_jsx {
http_server: true,
});
itest!(_049_info_flag_script_jsx {
// TODO(nayeemrmn): This hits an SWC type-stripping bug:
// `error: Unterminated regexp literal at http://localhost:4545/cli/tests/subdir/mt_video_vdn_tsx.t2.tsx:4:19`
// Re-enable once fixed.
itest_ignore!(_049_info_flag_script_jsx {
args: "info http://127.0.0.1:4545/cli/tests/048_media_types_jsx.ts",
output: "049_info_flag_script_jsx.out",
http_server: true,