mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
### What does this PR do? Fixes a bug since Bun v1.0.15: `var f = ([1, 2], "hi");` Fixes a regression since Bun v1.2.22: `var f = (new Array([1, 2]), "hi");` Fixes #23287 ### How did you verify your code works? Added a test
30 lines
770 B
TypeScript
30 lines
770 B
TypeScript
import { expect, test } from "bun:test";
|
|
import { bunEnv, bunExe, tempDir } from "harness";
|
|
|
|
test("issue #23287: (new Array([1, 2]), 'hi') parses correctly", async () => {
|
|
using dir = tempDir("issue-23287", {
|
|
"index.js": `
|
|
// failing since Bun v1.2.22
|
|
var f = (new Array([1, 2]), "hi");
|
|
// failing since Bun v1.0.15
|
|
var h = ([1, 2], "hi");
|
|
console.log(f, h);
|
|
`,
|
|
});
|
|
|
|
const { stdout, stderr, exited } = Bun.spawn({
|
|
cmd: [bunExe(), "index.js"],
|
|
cwd: dir,
|
|
env: bunEnv,
|
|
stdout: "pipe",
|
|
stderr: "pipe",
|
|
stdin: "ignore",
|
|
});
|
|
|
|
const [out, err, exitCode] = await Promise.all([stdout.text(), stderr.text(), exited]);
|
|
|
|
expect(err).toBe("");
|
|
expect(out).toBe("hi hi\n");
|
|
expect(exitCode).toBe(0);
|
|
});
|