perf: add vitest test perf workflows

This commit is contained in:
Peter Steinberger
2026-03-23 04:40:45 +00:00
parent 1c60e00a34
commit 7909236bd1
10 changed files with 131 additions and 3 deletions

View File

@@ -13,11 +13,12 @@ export function resolveVitestIsolation(
export function createScopedVitestConfig(
include: string[],
options?: { exclude?: string[]; pool?: "threads" | "forks" },
options?: { dir?: string; exclude?: string[]; pool?: "threads" | "forks" },
) {
const base = baseConfig as unknown as Record<string, unknown>;
const baseTest =
(baseConfig as { test?: { exclude?: string[]; pool?: "threads" | "forks" } }).test ?? {};
(baseConfig as { test?: { dir?: string; exclude?: string[]; pool?: "threads" | "forks" } })
.test ?? {};
const exclude = [...(baseTest.exclude ?? []), ...(options?.exclude ?? [])];
return defineConfig({
@@ -25,6 +26,7 @@ export function createScopedVitestConfig(
test: {
...baseTest,
isolate: resolveVitestIsolation(),
...(options?.dir ? { dir: options.dir } : {}),
include,
exclude,
...(options?.pool ? { pool: options.pool } : {}),