From 6528bb9166d40a07e76cfff4d59b3e141e57219c Mon Sep 17 00:00:00 2001 From: pfg Date: Thu, 24 Jul 2025 15:05:33 -0700 Subject: [PATCH] test case for utf-16 change --- src/bun.js/RuntimeTranspilerCache.zig | 3 ++- test/bundler/bundler_string.test.ts | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/bun.js/RuntimeTranspilerCache.zig b/src/bun.js/RuntimeTranspilerCache.zig index 6c9baa3fd7..e4daed7ee2 100644 --- a/src/bun.js/RuntimeTranspilerCache.zig +++ b/src/bun.js/RuntimeTranspilerCache.zig @@ -12,7 +12,8 @@ /// Version 13: Hoist `import.meta.require` definition, see #15738 /// Version 14: Updated global defines table list. /// Version 15: Updated global defines table list. -const expected_version = 15; +/// Version 16: Emojis in strings are preserved in unicode output (node/web) +const expected_version = 16; const debug = Output.scoped(.cache, false); const MINIMUM_CACHE_SIZE = 50 * 1024; diff --git a/test/bundler/bundler_string.test.ts b/test/bundler/bundler_string.test.ts index 88efba7780..7afd90e93d 100644 --- a/test/bundler/bundler_string.test.ts +++ b/test/bundler/bundler_string.test.ts @@ -1,4 +1,4 @@ -import { describe } from "bun:test"; +import { describe, expect } from "bun:test"; import { dedent, itBundled } from "./expectBundled"; interface TemplateStringTest { @@ -89,6 +89,20 @@ const templateStringTests: Record = { }; describe("bundler", () => { + // Test for emoji output in bun build + itBundled("string/EmojiDirectOutput", { + files: { + "a.js": `console.log("😀");`, + }, + outfile: "out.js", + onAfterBundle(api) { + const content = api.readFile("out.js"); + expect(content).toContain("😀"); + expect(content).not.toContain("\\ud83d"); + expect(content).not.toContain("\\ude00"); + }, + }); + for (const key in templateStringTests) { const test = templateStringTests[key]; if ([test.capture, test.captureRaw, test.print].filter(x => x !== undefined).length !== 1) {