mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Fixes #23865, Fixes ENG-21446 Previously, a termination exception would be thrown. We didn't handle it properly and eventually it got caught by a `catch @panic()` handler. Now, no termination exception is thrown. ``` drainMicrotasksWithGlobal calls JSC__JSGlobalObject__drainMicrotasks JSC__JSGlobalObject__drainMicrotasks returns m_terminationException -> drainMicrotasksWithGlobal -> event_loop.zig:exit, which catches the error and discards it -> ... ``` For workers, we will need to handle termination exceptions in this codepath. ~~Previously, it would see the exception, call reportUncaughtExceptoinAtEventLoop, but the exception would still survive and return out from the catch scope. You're not supposed to still have an exception signaled at the exit of a catch scope. Exception checker may not have caught it because maybe the branch wasn't taken.~~ --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
28 lines
772 B
TypeScript
28 lines
772 B
TypeScript
import { bunEnv, bunExe, normalizeBunSnapshot } from "harness";
|
|
|
|
// the test should time out, not crash
|
|
test("23865", async () => {
|
|
const proc = Bun.spawn({
|
|
cmd: [bunExe(), "test", "./23865.fixture.ts"],
|
|
env: bunEnv,
|
|
cwd: import.meta.dir,
|
|
stdout: "pipe",
|
|
stderr: "pipe",
|
|
});
|
|
|
|
const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]);
|
|
|
|
expect(exitCode).not.toBe(0);
|
|
expect(normalizeBunSnapshot(stdout)).toMatchInlineSnapshot(`"bun test <version> (<revision>)"`);
|
|
expect(normalizeBunSnapshot(stderr)).toMatchInlineSnapshot(`
|
|
"23865.fixture.ts:
|
|
(fail) abc
|
|
^ this test timed out after 50ms.
|
|
|
|
0 pass
|
|
1 fail
|
|
1 expect() calls
|
|
Ran 1 test across 1 file."
|
|
`);
|
|
});
|