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

workspace: __vitest_browser_runner__.runTests is not a function #6674

Open
6 tasks done
unional opened this issue Oct 9, 2024 · 3 comments
Open
6 tasks done

workspace: __vitest_browser_runner__.runTests is not a function #6674

unional opened this issue Oct 9, 2024 · 3 comments

Comments

@unional
Copy link

unional commented Oct 9, 2024

Describe the bug

I'm in a monorepo with one of the projects using storybook 8.3 with vitest integration in browser mode.

When running vitest on the project it is working fine.
But when running vitest at the root using workspace it fails with the __vitest_browser_runner__.runTests is not a function error.

The error is similar to #6023, but I'm using vitest 2.1.2 and the resolution is working fine (I am using pnpm and @vitest/runner are all 2.1.2, and as mentioned above vitest is working when running directly).

I also tried to run against that project from the root and it also fail:

vitest "--project=@panwds/storybook" "--printConsoleTrace"


 DEV  v2.1.2 /Users/hwong/pan/panwds
      [@panwds/storybook] Browser runner started by playwright at http://localhost:5173/


⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Vitest caught 4 unhandled errors during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
TypeError: __vitest_browser_runner__.runTests is not a function

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
TypeError: __vitest_browser_runner__.runTests is not a function

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
TypeError: __vitest_browser_runner__.runTests is not a function

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
TypeError: __vitest_browser_runner__.runTests is not a function

Reproduction

TBR - To Be Repro

System Info

System:
    OS: macOS 14.7
    CPU: (10) arm64 Apple M1 Pro
    Memory: 70.25 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.9.0 - ~/.local/state/fnm_multishells/35483_1728501155293/bin/node
    npm: 10.8.3 - ~/.local/state/fnm_multishells/35483_1728501155293/bin/npm
    pnpm: 9.12.1 - ~/.nvm/versions/node/v20.12.2/bin/pnpm
    bun: 0.1.6 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 129.1.70.119
    Chrome: 129.0.6668.90
    Safari: 18.0
  npmPackages:
    @vitest/browser: ^2.1.2 => 2.1.2 
    @vitest/coverage-v8: ^2.1.2 => 2.1.2 
    vitest: ^2.1.2 => 2.1.2

Used Package Manager

pnpm

Validations

Copy link

github-actions bot commented Oct 9, 2024

Hello @unional. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with needs reproduction will be closed if they have no activity within 3 days.

@sheremet-va
Copy link
Member

There are probably more errors in the console when you open the browser, by the way

@lfantone
Copy link

I'm facing the same issue, but something that I noticed is that fails only when running the test with vitest run while in watch mode works fine.

Could be something related with playwright closing the browser too soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants