-
Notifications
You must be signed in to change notification settings - Fork 135
Description
Describe the bug
In Vite+ browser tests, importing @vitest/browser/context fails at runtime.
Expected result:
@vitest/browser/context should resolve and load successfully in browser tests.
Actual result:
vp test fails with the following error:
TypeError: Failed to fetch dynamically imported module: .../dist/@vitest/browser/@vitest/browser/context.js
This issue originally occurred when using Storybook and @storybook/addon-vitest, but Storybook is not required for the attached reproduction steps.
Reproduction
https://github.com/hwld/vite-plus-vitest-browser-context-repro
Steps to reproduce
git clone https://github.com/hwld/vite-plus-vitest-browser-context-repro.git
cd vite-plus-vitest-browser-context-repro
vp install
vp exec playwright install --with-deps chromium
vp test
It also reproduces on GitHub Actions:
https://github.com/hwld/vite-plus-vitest-browser-context-repro/actions/runs/23100536009
System Info
VITE+ - The Unified Toolchain for the Web
Environment:
Version 24.14.0
Source lts
Tool Paths:
node /Users/hwld/.vite-plus/js_runtime/node/24.14.0/bin/node
npm /Users/hwld/.vite-plus/js_runtime/node/24.14.0/bin/npm
npx /Users/hwld/.vite-plus/js_runtime/node/24.14.0/bin/npx
VITE+ - The Unified Toolchain for the Web
vp v0.1.11
Local vite-plus:
vite-plus v0.1.11
Tools:
vite v8.0.0
rolldown v1.0.0-rc.9
vitest v4.1.0
oxfmt v0.40.0
oxlint v1.55.0
oxlint-tsgolint v0.16.0
tsdown v0.21.2Used Package Manager
pnpm
Logs
❯ vp test
Loaded vitest@0.1.11 and @vitest/browser@4.1.0 .
Running mixed versions is not supported and may lead into bugs
Update your dependencies and make sure the versions match.
❯ chromium repro.browser.test.ts (1 test | 1 failed) 5ms
× loads browser context 4ms
FAIL chromium repro.browser.test.ts > loads browser context
TypeError: Failed to fetch dynamically imported module: http://localhost:63315/node_modules/.pnpm/@voidzero-dev+vite-plus-test@0.1.11_@voidzero-dev+vite-plus-core@0.1.11_typescript@5.9.3__typescript@5.9.3/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/browser/@vitest/browser/context.js
Test Files 1 failed (1)
Tests 1 failed (1)
Start at 10:49:57
Duration 1.42s (transform 0ms, setup 0ms, import 15ms, tests 5ms, environment 0ms)Validations
- Read the Contributing Guidelines.
- Check that there isn't already an issue for the same bug.
- Confirm this is a Vite+ issue and not an upstream issue (Vite, Vitest, tsdown, Rolldown, or Oxc).
- The provided reproduction is a minimal reproducible example.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackPriority
None yet
Effort
None yet