mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-28 00:43:57 +00:00
fix(ci): split unit-fast into bounded shared-worker lanes
This commit is contained in:
@@ -9,6 +9,24 @@ import {
|
||||
const base = baseConfig as unknown as Record<string, unknown>;
|
||||
const baseTest = (baseConfig as { test?: { include?: string[]; exclude?: string[] } }).test ?? {};
|
||||
const exclude = baseTest.exclude ?? [];
|
||||
function loadPatternListFile(filePath: string, label: string): string[] {
|
||||
const parsed = JSON.parse(fs.readFileSync(filePath, "utf8")) as unknown;
|
||||
if (!Array.isArray(parsed)) {
|
||||
throw new TypeError(`${label} must point to a JSON array: ${filePath}`);
|
||||
}
|
||||
return parsed.filter((value): value is string => typeof value === "string" && value.length > 0);
|
||||
}
|
||||
|
||||
export function loadIncludePatternsFromEnv(
|
||||
env: Record<string, string | undefined> = process.env,
|
||||
): string[] | null {
|
||||
const includeFile = env.OPENCLAW_VITEST_INCLUDE_FILE?.trim();
|
||||
if (!includeFile) {
|
||||
return null;
|
||||
}
|
||||
return loadPatternListFile(includeFile, "OPENCLAW_VITEST_INCLUDE_FILE");
|
||||
}
|
||||
|
||||
export function loadExtraExcludePatternsFromEnv(
|
||||
env: Record<string, string | undefined> = process.env,
|
||||
): string[] {
|
||||
@@ -16,20 +34,14 @@ export function loadExtraExcludePatternsFromEnv(
|
||||
if (!extraExcludeFile) {
|
||||
return [];
|
||||
}
|
||||
const parsed = JSON.parse(fs.readFileSync(extraExcludeFile, "utf8")) as unknown;
|
||||
if (!Array.isArray(parsed)) {
|
||||
throw new TypeError(
|
||||
`OPENCLAW_VITEST_EXTRA_EXCLUDE_FILE must point to a JSON array: ${extraExcludeFile}`,
|
||||
);
|
||||
}
|
||||
return parsed.filter((value): value is string => typeof value === "string" && value.length > 0);
|
||||
return loadPatternListFile(extraExcludeFile, "OPENCLAW_VITEST_EXTRA_EXCLUDE_FILE");
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
...base,
|
||||
test: {
|
||||
...baseTest,
|
||||
include: unitTestIncludePatterns,
|
||||
include: loadIncludePatternsFromEnv() ?? unitTestIncludePatterns,
|
||||
exclude: [
|
||||
...new Set([
|
||||
...exclude,
|
||||
|
||||
Reference in New Issue
Block a user