Is it possible to mix browser tests and Node unit tests in the same package? #5461
-
|
I've got a package that I could like to test in both unit tests and in browser based tests. I know I could write two separate configs and have two separate invocations from |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
This can be done with Vitest Workspaces. I have a project using it here: https://github.com/AriPerkkio/aria-live-capture/blob/master/vitest.workspace.ts. It runs test cases in JSDOM on Node and in browser mode. |
Beta Was this translation helpful? Give feedback.
-
|
First I set up the project, and it didn't work, ends up using different vitest config files, then it is working, check my example repo: https://github.com/stevez/restaurant-reviews-platform/blob/main/package.json, also I implement a tool to merge the browser tests and node tests: https://www.npmjs.com/package/vitest-coverage-merge |
Beta Was this translation helpful? Give feedback.
You can also use
extendsoption instead of spreading the config:There is an example in documentation: https://main.vitest.dev/guide/browser/#configuration