WhatBrokeToday
GTA 6FAQ
Bun

Bun Test vi.importActual() Returns Mock Instead of Actual Node Builtin

medium

Is it fixed? Not yet.

Ongoing since Nov 12, 10:32 UTC. First reported Nov 12, 10:32 UTC.

What happened

In Bun 1.4.4-canary, using vi.importActual() on an already loaded Node builtin inside a vi.mock() factory incorrectly returns the mock instead of the actual module. Developers using Bun's test runner compatibility with Vitest may experience unexpected mocking behavior.

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.

Timeline

  1. Investigating(current)
  2. Workaround available(upcoming)
  3. Resolved(upcoming)
  1. First report on GitHub issue

    bun test: vi.importActual() of an already loaded Node builtin returns the mock in a vi.mock() factory

    Source

Evidence

1 report · 1 GitHubShow
  1. [1]
    GitHub First report
    bun test: vi.importActual() of an already loaded Node builtin returns the mock in a vi.mock() factory(opens GitHub issue in a new tab)

    What version of Bun is running? 1.4.4-canary.1+447ff870b (npm @oven/bun-linux-x64@1.4.4-canary.20261111.1) What platform is your computer? Linux 7.0.0 x86_64 What steps can reproduce the bug? Two files: // first.test.ts import os from 'node:os'; import { it } from 'vitest'; it('loads os', () => { os.hostname(); }); // second.test.ts import { vi, it, expect } from 'vitest'; import * as os from 'os'; const box = vi.hoisted(() => ({ real: undefined as any })); vi.mock('os', async () => { const…

    by azad-ide[bot] 0upvotes 1comments

FAQ

What happened in the Bun issue?

In Bun 1.4.4-canary, using vi.importActual() on an already loaded Node builtin inside a vi.mock() factory incorrectly returns the mock instead of the actual module. Developers using Bun's test runner compatibility with Vitest may experience unexpected mocking behavior.

What is affected by the Bun issue?

Bun (versions: 1.4.4-canary.1+447ff870b).

When did the Bun issue start and end?

It started Nov 12, 10:32 UTC and is still ongoing (6 d 18 h 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 1 report from 1 independent source.