From 2ce42f6e7a199ce50a387c910aa43e34943a9ae9 Mon Sep 17 00:00:00 2001 From: bowenliang123 Date: Fri, 16 Oct 2026 23:18:16 +0800 Subject: [PATCH] perf(client): run the client suite in the vmThreads pool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vitest 5's duration diagnostics flagged that the jsdom environment was created once per client file — 111 times, 36% of tracked time. vmThreads creates it once per worker while keeping per-file isolation, so the same 153 files / 2429 tests and the same 100%-per-file coverage scope (131 instrumented files) now finish in ~16.7s instead of ~24.0s: paired interleaved medians of five gate runs, and ~46% faster at the CI runner's four workers. Client-only: the host project fails under vmThreads (10 files), and the `isolate: false` shortcut the same hint offers fails two client files. Peak process-tree memory rises ~0.9 GB (3.0 -> 3.9 GB). --- vitest.config.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vitest.config.ts b/vitest.config.ts index 0e6778f..a95f1ae 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -19,6 +19,8 @@ export default defineConfig({ name: 'client', include: ['tests/client/**/*.spec.ts'], environment: 'jsdom', + // One jsdom environment per worker instead of one per file (111 files): ~30% off the coverage gate. Client-only — the host project fails under this pool. + pool: 'vmThreads', setupFiles: ['tests/client/setup.ts'], server: { deps: {