summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/flags.rs38
-rw-r--r--tests/036_import_map_fetch.out0
-rw-r--r--tests/036_import_map_fetch.test2
3 files changed, 30 insertions, 10 deletions
diff --git a/cli/flags.rs b/cli/flags.rs
index ad08b5a7a..978b0409f 100644
--- a/cli/flags.rs
+++ b/cli/flags.rs
@@ -100,16 +100,6 @@ fn add_run_args<'a, 'b>(app: App<'a, 'b>) -> App<'a, 'b> {
Arg::with_name("no-fetch")
.long("no-fetch")
.help("Do not download remote modules"),
- ).arg(
- Arg::with_name("importmap")
- .long("importmap")
- .value_name("FILE")
- .help("Load import map file")
- .long_help(
- "Load import map file
-Specification: https://wicg.github.io/import-maps/
-Examples: https://github.com/WICG/import-maps#the-import-map",
- ).takes_value(true),
)
}
@@ -169,6 +159,18 @@ To get help on the another subcommands (run in this case):
.takes_value(true)
.global(true),
).arg(
+ Arg::with_name("importmap")
+ .long("importmap")
+ .value_name("FILE")
+ .help("Load import map file")
+ .long_help(
+ "Load import map file
+Specification: https://wicg.github.io/import-maps/
+Examples: https://github.com/WICG/import-maps#the-import-map",
+ )
+ .takes_value(true)
+ .global(true),
+ ).arg(
Arg::with_name("seed")
.long("seed")
.value_name("NUMBER")
@@ -1368,6 +1370,22 @@ mod tests {
);
assert_eq!(subcommand, DenoSubcommand::Run);
assert_eq!(argv, svec!["deno", "script.ts"]);
+
+ let (flags, subcommand, argv) = flags_from_vec(svec![
+ "deno",
+ "fetch",
+ "--importmap=importmap.json",
+ "script.ts"
+ ]);
+ assert_eq!(
+ flags,
+ DenoFlags {
+ import_map_path: Some("importmap.json".to_owned()),
+ ..DenoFlags::default()
+ }
+ );
+ assert_eq!(subcommand, DenoSubcommand::Fetch);
+ assert_eq!(argv, svec!["deno", "script.ts"]);
}
#[test]
diff --git a/tests/036_import_map_fetch.out b/tests/036_import_map_fetch.out
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/036_import_map_fetch.out
diff --git a/tests/036_import_map_fetch.test b/tests/036_import_map_fetch.test
new file mode 100644
index 000000000..962573587
--- /dev/null
+++ b/tests/036_import_map_fetch.test
@@ -0,0 +1,2 @@
+args: fetch --reload --importmap=tests/importmaps/import_map.json tests/importmaps/test.ts
+output: tests/036_import_map_fetch.out