aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cli/run/require-cache.test.ts4
-rw-r--r--test/cli/run/run-unicode.test.ts21
-rw-r--r--test/js/node/process/print-process-args.js4
-rw-r--r--test/js/node/vm/vm.test.ts3
-rw-r--r--test/transpiler/decorators.test.ts2
5 files changed, 26 insertions, 8 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");
+});
diff --git a/test/js/node/process/print-process-args.js b/test/js/node/process/print-process-args.js
index e9d2295c8..c34c1b231 100644
--- a/test/js/node/process/print-process-args.js
+++ b/test/js/node/process/print-process-args.js
@@ -3,8 +3,8 @@ import assert from "assert";
// ensure process.argv and Bun.argv are the same
assert.deepStrictEqual(process.argv, Bun.argv, "process.argv does not equal Bun.argv");
assert(process.argv === process.argv, "process.argv isn't cached");
-// assert(Bun.argv === Bun.argv, 'Bun.argv isn\'t cached');
-// assert(Bun.argv === process.argv, 'Bun.argv doesnt share same ref as process.argv');
+assert(Bun.argv === Bun.argv, "Bun.argv isn't cached");
+// assert(Bun.argv === process.argv, "Bun.argv doesnt share same ref as process.argv");
var writer = Bun.stdout.writer();
writer.write(JSON.stringify(process.argv));
diff --git a/test/js/node/vm/vm.test.ts b/test/js/node/vm/vm.test.ts
index 79becfed0..4e291ac9f 100644
--- a/test/js/node/vm/vm.test.ts
+++ b/test/js/node/vm/vm.test.ts
@@ -18,7 +18,6 @@ describe("Script", () => {
describe("runInContext()", () => {
testRunInContext(
(code, context, options) => {
- // @ts-expect-error
const script = new Script(code, options);
return script.runInContext(context);
},
@@ -28,7 +27,6 @@ describe("Script", () => {
describe("runInNewContext()", () => {
testRunInContext(
(code, context, options) => {
- // @ts-expect-error
const script = new Script(code, options);
return script.runInNewContext(context);
},
@@ -37,7 +35,6 @@ describe("Script", () => {
});
describe("runInThisContext()", () => {
testRunInContext((code, context, options) => {
- // @ts-expect-error
const script = new Script(code, options);
return script.runInThisContext(context);
});
diff --git a/test/transpiler/decorators.test.ts b/test/transpiler/decorators.test.ts
index 0feacda2b..cb328029b 100644
--- a/test/transpiler/decorators.test.ts
+++ b/test/transpiler/decorators.test.ts
@@ -729,7 +729,7 @@ test("decorators with different property key types", () => {
"string" = 30;
@d1("string method")
"string method"() {}
- @d1(12e3)
+ @d1(12000)
12e3 = "number key";
@d1(12e3 + 1)
[12e3 + 1]() {}