diff options
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, + ); +} |