From 91443bbc0b3e5420d8a0b3506f1b18a88d48560a Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 8 Dec 2022 11:50:09 -0500 Subject: fix(compile): ensure import map is used when specified in deno config file (#16990) Closes #14246 --- cli/tests/compile_tests.rs | 34 ++++++++++++++++++++++ .../compile/standalone_import_map_config.json | 3 ++ 2 files changed, 37 insertions(+) create mode 100644 cli/tests/testdata/compile/standalone_import_map_config.json (limited to 'cli/tests') diff --git a/cli/tests/compile_tests.rs b/cli/tests/compile_tests.rs index 869a8780e..970ef5ee3 100644 --- a/cli/tests/compile_tests.rs +++ b/cli/tests/compile_tests.rs @@ -448,6 +448,40 @@ mod compile { assert!(output.status.success()); } + #[test] + fn standalone_import_map_config_file() { + let dir = TempDir::new(); + let exe = if cfg!(windows) { + dir.path().join("import_map.exe") + } else { + dir.path().join("import_map") + }; + let output = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("compile") + .arg("--unstable") + .arg("--allow-read") + .arg("--config") + .arg("compile/standalone_import_map_config.json") + .arg("--output") + .arg(&exe) + .arg("./compile/standalone_import_map.ts") + .stdout(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + assert!(output.status.success()); + let output = Command::new(exe) + .stdout(std::process::Stdio::piped()) + .stderr(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + assert!(output.status.success()); + } + #[test] // https://github.com/denoland/deno/issues/12670 fn skip_rebundle() { diff --git a/cli/tests/testdata/compile/standalone_import_map_config.json b/cli/tests/testdata/compile/standalone_import_map_config.json new file mode 100644 index 000000000..4959827f4 --- /dev/null +++ b/cli/tests/testdata/compile/standalone_import_map_config.json @@ -0,0 +1,3 @@ +{ + "importMap": "./standalone_import_map.json" +} -- cgit v1.2.3