bun test --parallel --no-isolate prints a test's log under another file's header after a failure · Issue #46330 · oven-sh/bun · GitHub
Skip to content

bun test --parallel --no-isolate prints a test's log under another file's header after a failure #46330

Open

Description

@marcospgp

What version of Bun is running?

1.4.3 (c6da4a4). 1.4.2 (744846f) and 1.4.4-canary.1+0c864a07c behave the same.

What platform is your computer?

macOS 26.5.1, arm64

What steps can reproduce the bug?

An empty package.json and two test files:

a.test.ts

import { expect, test } from "bun:test";

test("a fails", () => {
  console.log("A1 printed by a.test.ts before its failure");
  expect(1).toBe(2);
});

test("a passes after the failure", () => {
  console.log("A2 printed by a.test.ts after its failure");
});

b.test.ts

import { test } from "bun:test";

test("b passes", async () => {
  await Bun.sleep(20);
  console.log("B1 printed by b.test.ts");
});

Run it about ten times:

bun test --parallel=2 --no-isolate

What is the expected behavior?

Every line a file's tests print shows under that file's header, as it always does with --isolate:

a.test.ts:
A1 printed by a.test.ts before its failure
error: expect(received).toBe(expected)
...
(fail) a fails
A2 printed by a.test.ts after its failure

b.test.ts:
B1 printed by b.test.ts

What do you see instead?

In about half the runs, the line a.test.ts prints after its failure shows under b.test.ts's header:

a.test.ts:
A1 printed by a.test.ts before its failure
error: expect(received).toBe(expected)

Expected: 2
Received: 1

      at <anonymous> (a.test.ts:5:13)
(fail) a fails [0.14ms]

b.test.ts:
A2 printed by a.test.ts after its failure
B1 printed by b.test.ts

Measured over 10 runs each: 5 with --no-isolate on 1.4.3, 4 on the canary, and 0 with --isolate.

Additional information

A reader trusts the header to say which file printed a line, so a log explaining a failure gets read as another file's. In a suite of 122 files on 8 workers, such a line landed under an unrelated file's header.

Drafted by Claude Opus 5.5 and posted by Marcos Pereira.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions