Files
bun.sh/test/regression/issue/09559.test.ts
pfg ee5fd51e88 Fix bundling for bun not using ascii_only (#9571)
* Fix bundling not using ascii_only

* add utf8 test to bundler_compile & make test source ascii

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-23 00:04:36 -07:00

25 lines
804 B
TypeScript

import { $ } from "bun";
import { expect, test } from "bun:test";
import { bunEnv, bunExe, tempDirWithFiles } from "harness";
import { readdirSync } from "node:fs";
import { join } from "path";
test("bun build --target bun should support non-ascii source", async () => {
const files = {
"index.js": `
console.log(JSON.stringify({\u{6211}: "a"}));
const \u{6211} = "b";
console.log(JSON.stringify({\u{6211}}));
`,
};
const filenames = Object.keys(files);
const source = tempDirWithFiles("source", files);
$.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(`{"\u{6211}":"a"}\n{"\u{6211}":"b"}\n`);
});