summaryrefslogtreecommitdiff
path: root/cli/tests/compiler_api_test.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-02-16 12:02:00 +1100
committerGitHub <noreply@github.com>2021-02-16 12:02:00 +1100
commit7e9028b53227ce67f56df79f623b2f12fda756b5 (patch)
tree219196be5187bb246fdc72ef41a92c66dac93fe5 /cli/tests/compiler_api_test.ts
parenta6beab824815cededf0ba9fc7904d3b00fde75e4 (diff)
feat(cli): Deno.emit supports bundling as IIFE (#9291)
Closes #9204
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 bcee2bc43..427d3af54 100644
--- a/cli/tests/compiler_api_test.ts
+++ b/cli/tests/compiler_api_test.ts
@@ -319,3 +319,22 @@ Deno.test({
assert(typeof files[`${specifier}.js.map`] === "string");
},
});
+
+Deno.test({
+ name: `Deno.emit() - bundle supports iife`,
+ async fn() {
+ const { diagnostics, files } = await Deno.emit("/a.ts", {
+ bundle: "iife",
+ sources: {
+ "/a.ts": `import { b } from "./b.ts";
+ console.log(b);`,
+ "/b.ts": `export const b = "b";`,
+ },
+ });
+ assert(diagnostics);
+ assertEquals(diagnostics.length, 0);
+ assertEquals(Object.keys(files).length, 1);
+ assert(files["deno:///bundle.js"].startsWith("(function() {\n"));
+ assert(files["deno:///bundle.js"].endsWith("})();\n"));
+ },
+});