From 1d55ef8684c9b18bdee9959b5d8df9bd77512707 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Wed, 19 Aug 2026 23:19:24 -0700 Subject: [PATCH] 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. --- .github/workflows/test-litellm-ui-unit.yml | 4 ++-- ui/litellm-dashboard/vitest.config.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-litellm-ui-unit.yml b/.github/workflows/test-litellm-ui-unit.yml index 314efcc49d5..473808864fa 100644 --- a/.github/workflows/test-litellm-ui-unit.yml +++ b/.github/workflows/test-litellm-ui-unit.yml @@ -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 diff --git a/ui/litellm-dashboard/vitest.config.ts b/ui/litellm-dashboard/vitest.config.ts index ca2a25cba9f..365b1f5cd9e 100644 --- a/ui/litellm-dashboard/vitest.config.ts +++ b/ui/litellm-dashboard/vitest.config.ts @@ -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,