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:
parent
e06875e9f7
commit
42772845f6
3 changed files with 34 additions and 0 deletions
23
cli/flags.rs
23
cli/flags.rs
|
@ -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![
|
||||
|
|
5
cli/tests/065_import_map_info.out
Normal file
5
cli/tests/065_import_map_info.out
Normal file
|
@ -0,0 +1,5 @@
|
|||
[WILDCARD]
|
||||
local: [WILDCARD]test.ts
|
||||
type: TypeScript
|
||||
deps: 7 unique (total [WILDCARD])
|
||||
[WILDCARD]
|
|
@ -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",
|
||||
|
|
Loading…
Add table
Reference in a new issue