feat!: support running tests using VM context#3203
feat!: support running tests using VM context#3203sheremet-va merged 87 commits intovitest-dev:mainfrom
Conversation
|
|
|
will that help with |
If you need speed, don't use Current version of this PR uses only workers to run tests in parallel. Will probably add a way to run |
Yeah I wish but in Lerna-Lite (a fork of Lerna), it uses a ton of
that would be really nice and I wonder if that would help with my opened issue #3129 that I still have and found no fix yet (apart from not running the test one at a time). I did migrate from Jest to Vitest regardless |
c3edc0d to
fd56878
Compare
|
With this third runner environment option, I wonder if the config should be refactored to replace |
Yes, I've been thinking about a similar approach. But technically it should also contain "browser". The list might be:
We decided against it for now to keep the same API. The |
|
What's a |
|
|
Thanks, that does sound awesome indeed to be finally able to stop fighting jsdom 👍 |
4e22f76 to
3bc676b
Compare
5a45332 to
7f4a3df
Compare
39e9855 to
939c81d
Compare
|
I think we also need to implement |
✅ Deploy Preview for fastidious-cascaron-4ded94 canceled.
|
6929bca to
62bcb35
Compare
aka bring all Jest (V8) bugs into Vitest
The idea is to have a separate pool that will spawn workers with tinypool, but they will not be isolated. Isolation is introduced by
vm.createContextinside the worker. For this, we need to implement our ownimporthandling. I think we should keep our__vitest_ssr_import__because it is the only way to support both ESM/CJS in the same file in wrongly bundled dependencies.This is an optional pool! You need to opt-in to use it:
via CLI argument:
--experimental-vm-threads(this will throw an error, if you use--threadsor--browserat the same time)via config option:
run only a subset of files using this pool with
poolMatchGlobYou also cannot disable isolation when using
experimentalVm, because this doesn't make sense with this pool. If you don't need isolation, usethreadsorchild_processdirectly.vmhas a notable memory leak problem, so we are also introducingexperimentalVmWorkerMemoryLimitoption (works like Jest's workerIdleMemoryLimit to destroy the worker before it reaches this point. It is set tomax_heap/number_of_workersby default. You might have better performance if you tweak this value manually.--experimental-vm-child-process(experimentalVmChildProcess) will be implemented in a separate PR.Pros:
Cons:
vmmodules nodejs/node#31658Breaking changes:
transformMode(weborssr). If transform mode is not specified, it will throw an error