Replies: 2 comments
-
|
@hi-ogawa, @sheremet-va |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
-
Browser tests running in forks pool when using nested projects in monorepo
Environment
Current Structure
I have a monorepo with the following structure:
Root Configuration (
vitest.config.ts)Sub-Project Configuration (
apps/web/vitest.config.ts)Test Files
Browser Test (
apps/web/vitest-example/HelloWorld.test.tsx):Node Test (
apps/web/vitest-example/sum.test.ts):Problem
When running tests from the root of the monorepo using
npm run test:browser(orvitest), I get the following error:What works:
vitestfromapps/web/directory works correctlyWhat doesn't work:
vitestfrom root directoryvitest-browser-reactrequires browser mode but test runs in Node.js poolExpected Behavior
When running from root:
apps/web/vitest.config.tsvia glob patternapps/*HelloWorld.test.tsxshould be routed to the "browser" project (browser mode)sum.test.tsshould be routed to the "node" project (Node.js environment)Questions
Is this a supported pattern? Can a sub-project config file (found via glob pattern) define nested projects using
defineConfigwith aprojectsarray?Should I use
defineProjectinstead? According to the documentation,defineProjectis recommended for project configs. However, I need multiple projects (browser + node) within the same sub-project. How should this be structured?Is there a better way to structure this? Should I:
Why does it work from sub-directory but not from root? Is this a known limitation or configuration issue?
Additional Context
Reproduction Steps
vitest.config.tsusingprojects: ["apps/*"]apps/web/vitest.config.tswith nested projects (browser + node)vitest-browser-reactvitestfrom root directoryThank you for your help!
Beta Was this translation helpful? Give feedback.
All reactions