Skip to content

Commit 9d52f94

Browse files
os-zhuangclaude
andauthored
perf(test): run the unit project with isolate:false (#2647)
Follow-up to #2644. With `isolate: true` every test file re-executes its module graph in a fresh registry; that is required for the `dom` projects (they leak ComponentRegistry overrides and happy-dom nodes across files) but not for `unit`, which is node-env pure logic with no such shared mutable state. Relaxing isolation just for `unit` lets the worker share one module graph across its files. Measured 3.2x faster for the project in isolation (38s -> 12s), which is a real speedup for local `vitest run --project unit` and watch-mode logic TDD. Full-suite / CI wall barely moves (the `dom` project gates it and runs concurrently), so this is a developer- experience win, not a CI one — the CI win needs the DOM hermeticity work tracked separately. Verified hermetic, not luckily-ordered: 241 files / 3215 tests stay green across a plain run plus three `--sequence.shuffle` seeds (1, 42, 98765), and the full suite is unchanged at 566 files / 6894 tests. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 0fc8935 commit 9d52f94

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

vitest.config.mts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,15 @@ export default defineConfig({
126126
test: {
127127
name: 'unit',
128128
environment: 'node',
129+
// The unit project is node-env pure logic with no ComponentRegistry
130+
// or DOM state to leak across files, so it can share a module graph
131+
// per worker instead of re-executing it per file. Measured 3.2x
132+
// faster (38s -> 12s for the project) with zero failures, holding
133+
// green across repeated and shuffled runs. The `dom`/`dom-heavy`
134+
// projects keep `isolate: true` — they DO leak (registry overrides,
135+
// happy-dom nodes); relaxing them needs the hermeticity fixes tracked
136+
// separately.
137+
isolate: false,
129138
setupFiles: [path.resolve(__dirname, 'vitest.setup.base.ts')],
130139
include: ['packages/**/*.test.ts', 'examples/**/*.test.ts'],
131140
exclude: [...sharedExclude, ...domTsTests],

0 commit comments

Comments
 (0)