diff --git a/packages/core/__tests__/issue-9520.mjs b/packages/core/__tests__/issue-9520.mjs new file mode 100644 index 000000000000..29a1290b81d0 --- /dev/null +++ b/packages/core/__tests__/issue-9520.mjs @@ -0,0 +1,34 @@ +import swc from ".."; + +it("should transform synchronously", () => { + const { code } = swc.transformSync(`export function foo() { + if (false) { + } + return 'foo'; +};`); + + expect(code).toMatchInlineSnapshot(` + "export function foo() { + if (false) {} + return 'foo'; + } + ; + " + `); +}); + +it("should transform asynchronously", async () => { + const { code } = await swc.transform(`export function foo() { + if (false) { + } + return 'foo'; +};`); + expect(code).toMatchInlineSnapshot(` + "export function foo() { + if (false) {} + return 'foo'; + } + ; + " + `); +});