diff options
author | 2022-01-21 03:39:27 -0800 | |
---|---|---|
committer | 2022-01-21 03:39:27 -0800 | |
commit | 9a5aa95893d047db0ab6d83303e30aaf3c9908cc (patch) | |
tree | 9889bde668b538aa4a80e72a7495b3dac93f3318 /integration/bunjs-only-snippets/transpiler.test.js | |
parent | 8d623e21b672065f0ad29c5183f56761fec37891 (diff) | |
download | bun-9a5aa95893d047db0ab6d83303e30aaf3c9908cc.tar.gz bun-9a5aa95893d047db0ab6d83303e30aaf3c9908cc.tar.zst bun-9a5aa95893d047db0ab6d83303e30aaf3c9908cc.zip |
[Bun.js] `Bun.Transpiler.transform` & `Bun.Transpiler.transformSync` APIs
Diffstat (limited to 'integration/bunjs-only-snippets/transpiler.test.js')
-rw-r--r-- | integration/bunjs-only-snippets/transpiler.test.js | 22 |
1 files changed, 19 insertions, 3 deletions
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); }); }); |