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 always fail when using mixed-typed workspaces #3577

Closed
6 tasks done
jaa134 opened this issue Jun 14, 2023 · 3 comments · Fixed by #3947
Closed
6 tasks done

Vitest browser mode tests always fail when using mixed-typed workspaces #3577

jaa134 opened this issue Jun 14, 2023 · 3 comments · Fixed by #3947
Labels
feat: browser Issues and PRs related to the browser runner

Comments

@jaa134
Copy link

jaa134 commented Jun 14, 2023

Describe the bug

I have a monorepo and I am taking advantage of Vitest workspaces. One workspace uses browser mode and the other workspace does NOT use browser mode.

When I run tests from the project root, the normal tests run fine, but browser tests always fail. The browser test can be extremely simple like expect(true).toBeTruthy() and it still fails. However, if I run the tests from the individual workspaces instead of the project root, then the tests always execute and succeed.

This seems to be a regression of the change made from this issue: #3363. I was able to verify this fix in the next release of Vitest.

Since then, I have upgraded to Vitest v0.32.0 and switched to using v8 as a coverage provider. Even If I switch back to c8, the bug still occurs. I should also note that running tests and collecting coverage or not collecting coverage makes no difference in the outcome.

Reproduction

https://stackblitz.com/edit/vitest-browser-mode-bug-2?file=package.json

System Info

- pnpm: v8.4.0
- vitest: ^0.32.0
- playwright: ^1.35.0
- pnpm workspaces
- vitest workspaces

  System:
    OS: macOS 11.6
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 2.85 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: 114.0.5735.106
    Firefox: 111.0
    Safari: 14.1.2
  npmPackages:
    @vitest/browser: ^0.32.0 => 0.32.0 
    @vitest/coverage-v8: ^0.32.0 => 0.32.0 
    @vitest/utils: ^0.32.0 => 0.32.0 
    vitest: ^0.32.0 => 0.32.0

Used Package Manager

pnpm

Validations

@stackblitz
Copy link

stackblitz bot commented Jun 14, 2023

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

@jaa134
Copy link
Author

jaa134 commented Jun 14, 2023

@sheremet-va I hope you don't mind me tagging you in this issue. I assume you might be able to provide more insight as this seems related to #3363.

@jaa134
Copy link
Author

jaa134 commented Aug 2, 2023

@sheremet-va Is there anything I can do for this ticket?

@sheremet-va sheremet-va added bug feat: browser Issues and PRs related to the browser runner and removed pending triage labels Aug 14, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Aug 30, 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.

2 participants