summaryrefslogtreecommitdiff
path: root/cli/tests/compiler_api_test.ts
diff options
context:
space:
mode:
authorSatya Rohith <me@satyarohith.com>2021-05-04 17:57:20 +0530
committerGitHub <noreply@github.com>2021-05-04 14:27:20 +0200
commit89b61b5d05b7441d42e4e88fe1180d9d3dc1727e (patch)
tree43afe9cca75060e7f5cece65317e7ad6c4217328 /cli/tests/compiler_api_test.ts
parent17118c41e4bf0cd8d9b78f72349c685d383b7291 (diff)
fix(cli): give context when failed to load import map (#10478)
Diffstat (limited to 'cli/tests/compiler_api_test.ts')
-rw-r--r--cli/tests/compiler_api_test.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/cli/tests/compiler_api_test.ts b/cli/tests/compiler_api_test.ts
index 04a4675b8..c6e7de651 100644
--- a/cli/tests/compiler_api_test.ts
+++ b/cli/tests/compiler_api_test.ts
@@ -338,3 +338,22 @@ Deno.test({
assert(files["deno:///bundle.js"].endsWith("})();\n"));
},
});
+
+Deno.test({
+ name: `Deno.emit() - throws descriptive error when unable to load import map`,
+ async fn() {
+ await assertThrowsAsync(
+ async () => {
+ await Deno.emit("/a.ts", {
+ bundle: "classic",
+ sources: {
+ "/a.ts": `console.log("hello");`,
+ },
+ importMapPath: "file:///import_map_does_not_exist.json",
+ });
+ },
+ Error,
+ "Unable to load 'file:///import_map_does_not_exist.json' import map",
+ );
+ },
+});