vitest-dev / vitest-dev/vitest
__vitest_browser_runner__.runTests is not a function when browser mode x customzied root
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 94
Description
Describe the bug
when the root is specified to an outside dir x browser mode
https://github.com/Jinjiang/reproductions/tree/vitest-browser-20250408
(not sure whether it's same to #6674)
Reproduction
https://github.com/Jinjiang/reproductions/tree/vitest-browser-20250408
cd tool
pnpm install
# it works
pnpm test
# it works
pnpm test2
# it doesn't work
pnpm test3
error:
Vitest caught 1 unhandled error 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
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
System Info
System:
OS: macOS 15.5
CPU: (8) arm64 Apple M1
Memory: 98.09 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.14.0 - ~/.local/share/mise/installs/node/22/bin/node
Yarn: 1.22.18 - ~/.yarn/bin/yarn
npm: 10.9.2 - ~/.local/share/mise/installs/node/22/bin/npm
pnpm: 10.7.1 - ~/Library/pnpm/pnpm
bun: 1.1.36 - ~/.local/share/mise/installs/bun/latest/bin/bun
Browsers:
Safari: 18.5
npmPackages:
@vitest/browser: ^3.1.1 => 3.1.1
playwright: ^1.51.1 => 1.51.1
vitest: ^3.1.1 => 3.1.1
Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked reproduction at Jinjiang/reproductions, enter its tool directory, install dependencies, and compare pnpm test, pnpm test2, and pnpm test3. Trace how browser mode handles a root outside the project directory and identify why the failing case exposes a missing runTests function. Done means the custom-root browser-mode case runs without the reported TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- playwright, typescript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100