Skip to content

Commit 9ce3625

Browse files
fix(test): state the printer's fallback where terser's sources cannot load
Deno cannot import terser's own sources through `load`, so it hands back terser's published entry point with no phase installed — which the test asserted could never happen. It now states both halves of that contract.
1 parent 52758fb commit 9ce3625

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎test/unitCases/syntax-printer.unittest.js‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,15 @@ const CASES = [
8989
describe("syntax-printer", () => {
9090
it("should install onto terser", async () => {
9191
const terser = await load();
92-
expect(terser.phases).toContain("mangle");
9392
expect(typeof terser.minify).toBe("function");
93+
// Deno cannot import terser's own sources here, so `load` hands back
94+
// terser's published entry point with no phase of ours installed —
95+
// the fallback every phase is written to allow.
96+
if (!("Deno" in globalThis)) {
97+
expect(terser.phases).toContain("mangle");
98+
} else {
99+
expect(terser.phases).toEqual([]);
100+
}
94101
});
95102

96103
for (const [name, source, options] of CASES) {

0 commit comments

Comments
 (0)