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

@@ -23,6 +23,7 @@ export function loadIncludePatternsFromEnv(
export default createScopedVitestConfig(
loadIncludePatternsFromEnv() ?? ["extensions/**/*.test.ts"],
{
pool: "threads",
// Channel implementations live under extensions/ but are tested by
// vitest.channels.config.ts (pnpm test:channels) which provides
// the heavier mock scaffolding they need.

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 } : {}),
},
});
}