Repository navigation
fix: keep per-file isolation in vm pools when maxWorkers is 1 - #10743
Conversation
✅ Deploy Preview for vitest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
AriPerkkio
left a comment
There was a problem hiding this comment.
Proper fix for this should be that vm pools themselves handle vm context recycling. They should be able to receive all specs from main thread in a single batch.
This PR seems to add work-around.
|
Oh well, I was just about to report the bug and realized it's fixed already 😄 |
Actually this might not be possible due to how I wonder if |
Description
vm pools resolve
isolatetofalseduring config resolution — their isolation comes from a fresh VM context per run request, not from worker lifecycle. The single-worker batching ingroupSpecstreated that resolved flag as a user opt-in: withmaxWorkers: 1, all same-environment files were packed into one run request, andrunVmTestsexecutes a whole run request in a single VM context. Every test file then shared one context —globalThis, DOM and module state leaked across files:vmThreads/vmForksare now excluded from that batching and fall back to one run request per file on the shared worker, restoring the same per-file context isolation as any othermaxWorkersvalue. No opt-in is lost: explicitisolatesettings are already overwritten for vm pools, soisolate: falsethere never expressed user intent to share state.