0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

fix(info): add --importmap flag (#7424)

This commit is contained in:
William Perron 2020-09-21 09:07:19 -04:00 committed by GitHub
parent e06875e9f7
commit 42772845f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 0 deletions

View file

@ -478,6 +478,7 @@ fn eval_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
fn info_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
reload_arg_parse(flags, matches);
importmap_arg_parse(flags, matches);
ca_file_arg_parse(flags, matches);
let json = matches.is_present("json");
flags.subcommand = DenoSubcommand::Info {
@ -884,6 +885,7 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.",
.arg(ca_file_arg())
// TODO(lucacasonato): remove for 2.0
.arg(no_check_arg().hidden(true))
.arg(importmap_arg())
.arg(
Arg::with_name("json")
.long("json")
@ -2375,6 +2377,27 @@ mod tests {
);
}
#[test]
fn info_importmap() {
let r = flags_from_vec_safe(svec![
"deno",
"info",
"--importmap=importmap.json",
"script.ts"
]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Info {
file: Some("script.ts".to_string()),
json: false,
},
import_map_path: Some("importmap.json".to_owned()),
..Flags::default()
}
);
}
#[test]
fn cache_importmap() {
let r = flags_from_vec_safe(svec![

View file

@ -0,0 +1,5 @@
[WILDCARD]
local: [WILDCARD]test.ts
type: TypeScript
deps: 7 unique (total [WILDCARD])
[WILDCARD]

View file

@ -1711,6 +1711,12 @@ itest!(_064_permissions_revoke_global {
output: "064_permissions_revoke_global.ts.out",
});
itest!(_065_import_map_info {
args:
"info --quiet --importmap=importmaps/import_map.json --unstable importmaps/test.ts",
output: "065_import_map_info.out",
});
itest!(js_import_detect {
args: "run --quiet --reload js_import_detect.ts",
output: "js_import_detect.ts.out",