perf(ui): run the vitest tiers on the threads pool

The dashboard suite ran every tier in the forks pool, which pays a child
process plus a fresh module graph per test file. Worker threads reuse the
process and cut the wall clock by about 20% on the same hardware, with no
change to how the tiers are isolated: vitest still gives each file its own
environment, so the per-file globals, module registry and jsdom document
stay exactly as they were.

Measured on the 743-file suite: 86s, 88s and 88s on forks against 71s, 66s
and 70s on threads, all 8,588 tests passing in every run.

The pool now lives in vitest.config.ts so local runs match CI, and the
workflow keeps pinning the worker count for the 16-core runner.
This commit is contained in:
Yuneng Jiang 2026-08-19 23:19:24 -07:00
parent 5290150a05
commit 1d55ef8684
No known key found for this signature in database
2 changed files with 4 additions and 2 deletions

View file

@ -65,7 +65,7 @@ jobs:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
full_suite() { npm run test -- --run --pool forks --poolOptions.forks.maxForks=14; }
full_suite() { npm run test -- --run --poolOptions.threads.maxThreads=14; }
if [ -z "$BASE_SHA" ]; then
echo "Push to $GITHUB_REF_NAME: running the full suite"
@ -94,4 +94,4 @@ jobs:
echo "Pull request: running tests related to ${#changed_files[@]} changed UI files"
npm run test -- related "${changed_files[@]}" --run --passWithNoTests \
--pool forks --poolOptions.forks.maxForks=14
--poolOptions.threads.maxThreads=14

View file

@ -29,6 +29,7 @@ const TEST_TS_FILES_THAT_RENDER_REACT: readonly string[] = [
];
const jsdomTier = {
pool: "threads" as const,
environment: "./tests/jsdomFetchEnv.ts",
setupFiles: ["tests/setupTests.ts"],
globals: true,
@ -45,6 +46,7 @@ const config: ViteUserConfig = {
...sharedViteConfig,
test: {
name: "unit",
pool: "threads",
environment: "node",
setupFiles: ["tests/setup.unit.ts"],
globals: true,