Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
1 parent
73a55cf
commit ee5fd51
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
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`); | ||
}); |