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

Vitest browser mode tests do not run when using workspaces #3363

Closed
6 tasks done
jaa134 opened this issue May 12, 2023 · 4 comments · Fixed by #3389
Closed
6 tasks done

Vitest browser mode tests do not run when using workspaces #3363

jaa134 opened this issue May 12, 2023 · 4 comments · Fixed by #3389
Labels
feat: browser Issues and PRs related to the browser runner

Comments

@jaa134
Copy link

jaa134 commented May 12, 2023

Describe the bug

I have a monorepo and I am taking advantage of Vitest workspaces. One workspace uses browser mode and another workspace does not. When I run tests from the project root, the normal tests run fine, but the process stalls when the browser tests run. The browser tests never execute and the process hangs indefinitely. However, if I run the tests from the individual workspaces instead of the project root, then the tests always execute and succeed.

Reproduction

Here is a link to a minimal reproduction StackBlitz: https://stackblitz.com/edit/vitest-browser-mode-bug?file=README.md

System Info

- pnpm: v8.4.0
- vitest: ^0.31.0
- playwright: ^1.33.0
- pnpm workspaces
- vitest workspaces

System:
    OS: macOS 11.6
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 1.15 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 18.14.2 - ~/.nvm/versions/node/v18.14.2/bin/node
    npm: 9.5.0 - ~/.nvm/versions/node/v18.14.2/bin/npm
  Browsers:
    Chrome: 113.0.5672.92
    Firefox: 111.0
    Safari: 14.1.2

Used Package Manager

pnpm

Validations

@stackblitz
Copy link

stackblitz bot commented May 12, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sheremet-va sheremet-va added bug feat: browser Issues and PRs related to the browser runner labels May 14, 2023
@drewlyton
Copy link

drewlyton commented May 24, 2023

👋 Hey, I know this was closed, but I'm still seeing a similar error with pnpm on v0.31.1

SyntaxError: The requested module '/@fs/Users/drew/Projects/framecrafter/node_modules/.pnpm/pretty-format@27.5.1/node_modules/pretty-format/build/index.js?v=8c92f7e1' does not provide an export named '__vi_inject__'

EDIT
I installed @vitest/utils as a devDependency and am now getting this error:

SyntaxError: The requested module '/node_modules/.vite/deps/@vitest_utils___pretty-format.js?v=e9c53d4f' does not provide an export named 'default'
This error originated in "src/lib/MP4Demuxer.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.

This is my browser mode configuration

 browser: {
      enabled: true,
      headless: true,
      name: "chromium",
      provider: "playwright",
    },

@christophe-g
Copy link

@drewlyton - do you have by any chance a package.json file or node_modules folder in your public folder ? This was creating similar problems for me, even under v0.31.1

@drewlyton
Copy link

@christophe-g thanks for commenting! No, I do not have anything other than media files in my public folder.

Also I think #3434 is the same issue (or similar) as mine 👍

@github-actions github-actions bot locked and limited conversation to collaborators Jun 8, 2023
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants