diff options
Diffstat (limited to 'test/cli')
-rw-r--r-- | test/cli/run/require-cache.test.ts | 4 | ||||
-rw-r--r-- | test/cli/run/run-unicode.test.ts | 21 |
2 files changed, 23 insertions, 2 deletions
diff --git a/test/cli/run/require-cache.test.ts b/test/cli/run/require-cache.test.ts index ed8e5ea38..77bf5708c 100644 --- a/test/cli/run/require-cache.test.ts +++ b/test/cli/run/require-cache.test.ts @@ -10,7 +10,7 @@ test("require.cache", () => { stderr: "inherit", }); - expect(stdout.toString().trim().endsWith("--pass--")).toBe(true); + expect(stdout.toString().trim()).toEndWith("--pass--"); expect(exitCode).toBe(0); }); @@ -22,6 +22,6 @@ test("require.cache does not include unevaluated modules", () => { stderr: "inherit", }); - expect(stdout.toString().trim().endsWith("--pass--")).toBe(true); + expect(stdout.toString().trim()).toEndWith("--pass--"); expect(exitCode).toBe(0); }); diff --git a/test/cli/run/run-unicode.test.ts b/test/cli/run/run-unicode.test.ts new file mode 100644 index 000000000..c1a9c2466 --- /dev/null +++ b/test/cli/run/run-unicode.test.ts @@ -0,0 +1,21 @@ +import { expect, test } from "bun:test"; +import { mkdirSync, realpathSync } from "fs"; +import { bunEnv, bunExe } from "harness"; +import { tmpdir } from "os"; +import { join } from "path"; + +test("running a weird filename works", async () => { + const troll = "💥'\"​\n"; + const dir = join(realpathSync(tmpdir()), "bun-run-test" + troll); + mkdirSync(dir, { recursive: true }); + console.log("dir", dir); + // i this it's possible that the filesystem rejects the path + await Bun.write(join(dir, troll + ".js"), "console.log('hello world');"); + let { stdout } = Bun.spawnSync({ + cmd: [bunExe(), join(dir, troll + ".js")], + cwd: dir, + env: bunEnv, + stdio: ["ignore", "pipe", "inherit"], + }); + expect(stdout.toString("utf8")).toEqual("hello world\n"); +}); |