diff options
author | Nayeem Rahman <muhammed.9939@gmail.com> | 2019-08-15 18:58:04 +0100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-08-15 13:58:04 -0400 |
commit | 52a66c2796f97f5a08d679389172c39c0652cb16 (patch) | |
tree | cbabdaa201495a331cf974e9de5a0723d8893aa6 /cli/state.rs | |
parent | d2d3afaf2de3cc9709cdf145c2f9438d3a4fa8a1 (diff) |
Fix import map panics, use import map's location as its base URL (#2770)
Diffstat (limited to 'cli/state.rs')
-rw-r--r-- | cli/state.rs | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/cli/state.rs b/cli/state.rs index 0b0f3b1ae..777382907 100644 --- a/cli/state.rs +++ b/cli/state.rs @@ -200,14 +200,7 @@ impl ThreadSafeState { let import_map: Option<ImportMap> = match &flags.import_map_path { None => None, - Some(file_name) => { - let base_url = match &main_module { - Some(module_specifier) => module_specifier.clone(), - None => unreachable!(), - }; - let import_map = ImportMap::load(&base_url.to_string(), file_name)?; - Some(import_map) - } + Some(file_path) => Some(ImportMap::load(file_path)?), }; let mut seeded_rng = None; @@ -380,3 +373,17 @@ fn thread_safe() { String::from("hello.js"), ])); } + +#[test] +fn import_map_given_for_repl() { + let _result = ThreadSafeState::new( + flags::DenoFlags { + import_map_path: Some("import_map.json".to_string()), + ..flags::DenoFlags::default() + }, + vec![String::from("./deno")], + ops::op_selector_std, + Progress::new(), + true, + ); +} |