test: default scoped vitest configs to no-isolate

This commit is contained in:
Peter Steinberger
2026-03-22 19:09:26 -07:00
parent 74cb08bede
commit 3ccf1bee2c
5 changed files with 55 additions and 1 deletions

View File

@@ -1,6 +1,16 @@
import { defineConfig } from "vitest/config";
import baseConfig from "./vitest.config.ts";
export function resolveVitestIsolation(
env: Record<string, string | undefined> = process.env,
): boolean {
const forceIsolation = env.OPENCLAW_TEST_ISOLATE === "1" || env.OPENCLAW_TEST_ISOLATE === "true";
if (forceIsolation) {
return true;
}
return env.OPENCLAW_TEST_NO_ISOLATE === "0" || env.OPENCLAW_TEST_NO_ISOLATE === "false";
}
export function createScopedVitestConfig(
include: string[],
options?: { exclude?: string[]; pool?: "threads" | "forks" },
@@ -14,6 +24,7 @@ export function createScopedVitestConfig(
...base,
test: {
...baseTest,
isolate: resolveVitestIsolation(),
include,
exclude,
...(options?.pool ? { pool: options.pool } : {}),