From 9a5aa95893d047db0ab6d83303e30aaf3c9908cc Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Fri, 21 Jan 2022 03:39:27 -0800 Subject: [Bun.js] `Bun.Transpiler.transform` & `Bun.Transpiler.transformSync` APIs --- integration/bunjs-only-snippets/transpiler.test.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'integration/bunjs-only-snippets/transpiler.test.js') diff --git a/integration/bunjs-only-snippets/transpiler.test.js b/integration/bunjs-only-snippets/transpiler.test.js index 2c59c10b8..0a33954c5 100644 --- a/integration/bunjs-only-snippets/transpiler.test.js +++ b/integration/bunjs-only-snippets/transpiler.test.js @@ -42,9 +42,25 @@ describe("Bun.Transpiler", () => { it("reports all export names", () => { const { imports, exports } = transpiler.scan(code); - expect(exports[0]).toBe("loader"); - expect(exports[1]).toBe("action"); - expect(exports[2]).toBe("default"); + expect(exports[0]).toBe("action"); + expect(exports[2]).toBe("loader"); + expect(exports[1]).toBe("default"); + + expect(exports).toHaveLength(3); + }); + }); + + describe("transform", () => { + it("removes types", () => { + const out = transpiler.transform(code); + expect(out.includes("ActionFunction")).toBe(false); + expect(out.includes("LoaderFunction")).toBe(false); + + const { exports } = transpiler.scan(out); + + expect(exports[0]).toBe("action"); + expect(exports[2]).toBe("loader"); + expect(exports[1]).toBe("default"); expect(exports).toHaveLength(3); }); }); -- cgit v1.2.3