Skip to content

Subpath import of @vitest/browser/context from @storybook/addon-vitest fails. #963

@hwld

Description

@hwld

Describe the bug

@storybook/addon-vitest internally imports @vitest/browser/context within test-utils.js. This import fails when running Storybook's browser tests using vp test.

This is similar to #894, but it differs in that vp migrate cannot fix it because the import comes from an external library.

Reproduction

https://github.com/hwld/vite-plus-vitest-browser-context-repro/tree/storybook-repro

Steps to reproduce

git clone https://github.com/hwld/vite-plus-vitest-browser-context-repro.git
cd vite-plus-vitest-browser-context-repro
git switch storybook-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/23143549750/job/67225684325

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.12

Local vite-plus:
  vite-plus  v0.1.12

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.17.0
  tsdown           v0.21.3

Environment:
  Package manager  pnpm v10.32.1
  Node.js          Not found

Used Package Manager

pnpm

Logs

Pre-transform error: Failed to load url .../vite-plus-test/dist/@vitest/browser/@vitest/browser/context.js

Validations

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions