Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser mode: unable to mock modules from workspace projects #7411

Closed
6 tasks done
jrobinson01 opened this issue Feb 3, 2025 · 0 comments · Fixed by #7415
Closed
6 tasks done

Browser mode: unable to mock modules from workspace projects #7411

jrobinson01 opened this issue Feb 3, 2025 · 0 comments · Fixed by #7415
Labels
feat: browser Issues and PRs related to the browser runner p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@jrobinson01
Copy link

Describe the bug

When using npm workspaces and attempting to mock a module from an adjacent workspace project, vitest in browser mode silently fails to mock modules from other projects in the same workspace. Running the tests with the vitest defaults works as expected.

Reproduction

https://github.com/jrobinson01/vitest-browser-workspace-mocks-issue
install deps then cd into package-a and run npm run test to run the test using vitest. Tests should pass. Run npm run test:browser and observe the failing test.

System Info

System:
    OS: macOS 14.7.3
    CPU: (12) arm64 Apple M2 Pro
    Memory: 568.36 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.15.0 - ~/.nvm/versions/node/v20.15.0/bin/node
    Yarn: 1.22.22 - ~/.yarn/bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v20.15.0/bin/npm
  Browsers:
    Chrome: 132.0.6834.160
    Chrome Canary: 134.0.6996.0
    Safari: 18.3

Used Package Manager

npm

Validations

@hi-ogawa hi-ogawa added feat: browser Issues and PRs related to the browser runner p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Feb 4, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: browser Issues and PRs related to the browser runner p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants