perf: default extension vitest lanes to threads

This commit is contained in:
Peter Steinberger
2026-03-22 12:35:44 -07:00
parent fdc993e779
commit c1067e90c9
2 changed files with 9 additions and 2 deletions

View File

@@ -1,9 +1,14 @@
import { defineConfig } from "vitest/config";
import baseConfig from "./vitest.config.ts";
export function createScopedVitestConfig(include: string[], options?: { exclude?: string[] }) {
export function createScopedVitestConfig(
include: string[],
options?: { exclude?: string[]; pool?: "threads" | "forks" | "vmForks" },
) {
const base = baseConfig as unknown as Record<string, unknown>;
const baseTest = (baseConfig as { test?: { exclude?: string[] } }).test ?? {};
const baseTest =
(baseConfig as { test?: { exclude?: string[]; pool?: "threads" | "forks" | "vmForks" } })
.test ?? {};
const exclude = [...(baseTest.exclude ?? []), ...(options?.exclude ?? [])];
return defineConfig({
@@ -12,6 +17,7 @@ export function createScopedVitestConfig(include: string[], options?: { exclude?
...baseTest,
include,
exclude,
...(options?.pool ? { pool: options.pool } : {}),
},
});
}