Bun issue (Nov 23): Bun Test Mocking and Vitest Compatibility Issues in Version 1.4.6-canary
Is it fixed? Not yet.
Ongoing since Nov 23, 11:16 UTC. First reported Nov 23, 11:16 UTC.
What happened
In Bun 1.4.6-canary.1+dac8e3b0f on macOS arm64, users have reported issues where mocking a loaded barrel module replaces functions in re-exporting modules, require() of helper modules calling jest.mock() with an import throws unsupported async module errors, jest.requireActual() inside mock factories loads second copies during import cycles, and Vitest wrapper callbacks with overridden toString() throw errors.
What caused it?
Under active investigation. No report has identified a root cause yet.
No verified workaround yet
None of the linked reports describe a mitigation. This page updates when one appears.
Outage timeline
- Investigating(current)
- Workaround available(upcoming)
- Resolved(upcoming)
- First report on GitHub issue
bun test: mocking a loaded barrel module replaces the function in the module it re-exports from
Source
Reports of this outage
4 reports · 4 GitHubShow
- [1]GitHub First reportbun test: mocking a loaded barrel module replaces the function in the module it re-exports from(opens GitHub issue in a new tab)
What version of Bun is running? 1.4.6-canary.1+dac8e3b0f What platform is your computer? macOS arm64 (Darwin 25.5.0) What steps can reproduce the bug? Four files in one directory. lib/greet.ts export function greet() { return "real greet"; } lib/welcome.ts import { greet } from "./greet"; export function welcome() { return welcome uses: ${greet()}; } lib/index.ts export { greet } from "./greet"; export { welcome } from "./welcome"; single.test.ts import { expect, mock, test } from "bun:test";…
by magarcia 0upvotes 1comments
- [2]GitHubbun test: require() of a helper module that calls jest.mock() and has an import throws "require() async module ... is unsupported"(opens GitHub issue in a new tab)
What version of Bun is running? 1.4.6-canary.1+dac8e3b0f What platform is your computer? macOS arm64 (Darwin 25.5.0) What steps can reproduce the bug? flags.ts export const flag = () => "real flag"; other.ts export const other = "other"; testUtils.ts (a shared test helper, not a test file and not a preload) import { jest } from "bun:test"; import { other } from "./other"; jest.mock("./flags", () => ({ flag: () => "mock flag" })); export const helper = helper with ${other}; require.test.ts…
by magarcia 0upvotes 1comments94% match
- [3]GitHubbun test: jest.requireActual() called through a helper in a mock factory loads second copies of modules in an import cycle(opens GitHub issue in a new tab)
What version of Bun is running? 1.4.6-canary.1+dac8e3b0f What platform is your computer? macOS arm64 (Darwin 25.5.0) What steps can reproduce the bug? dispatcher.ts export const callbacks: Array<(action: string) => void> = []; export const dispatch = (action: string) => callbacks.forEach((cb) => cb(action)); store.ts (registers a callback when it loads, like a Flux store) import { callbacks } from "./dispatcher"; import { checkDrift } from "./drift"; export const handled: string[] = [];…
by magarcia 0upvotes 1comments95% match
- [4]GitHubbun test: Vitest beforeAll()/afterAll() parse the callback's native source and ignore an overridden toString(), so wrapped callbacks (@effect/vitest) throw(opens GitHub issue in a new tab)
What version of Bun is running? 1.4.6-canary.1+dac8e3b0f What platform is your computer? macOS arm64 (Darwin 25.5.0) What steps can reproduce the bug? No dependencies: bun test serves the vitest import itself. before-all-wrapper-tostring.test.ts import { beforeAll, expect, it } from "vitest"; let ran = false; const inner = () => { ran = true; }; // A wrapper whose toString() returns the wrapped function's source, as Vitest wrappers do. const wrapper = Object.defineProperty( (...args:…
by magarcia 0upvotes 1comments93% match
Bun issue FAQ
What happened in the Bun issue, and why?
Ongoing since Nov 23, 11:16 UTC. No cause has been published yet; this page adds it once the vendor or a report explains it.
What is affected by the Bun issue?
Bun (versions: 1.4.6-canary.1+dac8e3b0f).
When did the Bun issue start and end?
It started Nov 23, 11:16 UTC and is still ongoing (35 min so far). This page updates as it develops.
How do I get alerts for Bun?
Subscribe to the Bun RSS feed for every new Bun incident, or connect an AI assistant to WhatBrokeToday over MCP and ask whether Bun is down. Bun feed
Where does this information come from?
WhatBrokeToday collects public status pages, developer community reports and security advisories, groups the ones about the same problem, and links every report under Evidence on this page. This one has 4 reports from 1 independent source.