diff --git a/test/bundler/bundler_compile.test.ts b/test/bundler/bundler_compile.test.ts index 70c2827656d003..1fdada5873270b 100644 --- a/test/bundler/bundler_compile.test.ts +++ b/test/bundler/bundler_compile.test.ts @@ -220,4 +220,13 @@ describe("bundler", () => { }, run: { stdout: "Hello, world!", setCwd: true }, }); + itBundled("compile/Utf8", { + compile: true, + files: { + "/entry.ts": /* js */ ` + console.log(JSON.stringify({\u{6211}: "\u{6211}"})); + `, + }, + run: { stdout: '{"\u{6211}":"\u{6211}"}' }, + }); }); diff --git a/test/regression/issue/09559.test.ts b/test/regression/issue/09559.test.ts index 329033b584a295..4e80c91302d06e 100644 --- a/test/regression/issue/09559.test.ts +++ b/test/regression/issue/09559.test.ts @@ -6,10 +6,10 @@ import { join } from "path"; test("bun build --target bun should support non-ascii source", async () => { const files = {"index.js": ` - console.log(JSON.stringify({我: "a"})); + console.log(JSON.stringify({\u{6211}: "a"})); const 我 = "b"; - console.log(JSON.stringify({我})); + console.log(JSON.stringify({\u{6211}})); `}; const filenames = Object.keys(files); const source = tempDirWithFiles("source", files); @@ -17,6 +17,6 @@ test("bun build --target bun should support non-ascii source", async () => { $.throws(true); await $`${bunExe()} build --target bun ${join(source, "index.js")} --outfile ${join(source, "bundle.js")}`; const result = await $`${bunExe()} ${join(source, "bundle.js")}`.text(); - - expect(result).toBe(`{"我":"a"}\n{"我":"b"}\n`); + + expect(result).toBe(`{"\u{6211}":"a"}\n{"\u{6211}":"b"}\n`); })