feat(cli): Deno.emit supports bundling as IIFE (#9291)

Closes #9204
This commit is contained in:
Kitson Kelly 2021-02-16 12:02:00 +11:00 committed by GitHub
parent a6beab8248
commit 7e9028b532
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 12 deletions

View file

@ -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"));
},
});