From 89b61b5d05b7441d42e4e88fe1180d9d3dc1727e Mon Sep 17 00:00:00 2001 From: Satya Rohith Date: Tue, 4 May 2021 17:57:20 +0530 Subject: fix(cli): give context when failed to load import map (#10478) --- cli/tests/compiler_api_test.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'cli/tests/compiler_api_test.ts') 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", + ); + }, +}); -- cgit v1.2.3