mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-27 09:21:35 +07:00
fix(ci): avoid Windows shell arg overflow in unit-fast
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import fs from "node:fs";
|
||||
import { defineConfig } from "vitest/config";
|
||||
import baseConfig from "./vitest.config.ts";
|
||||
import {
|
||||
@@ -8,12 +9,33 @@ import {
|
||||
const base = baseConfig as unknown as Record<string, unknown>;
|
||||
const baseTest = (baseConfig as { test?: { include?: string[]; exclude?: string[] } }).test ?? {};
|
||||
const exclude = baseTest.exclude ?? [];
|
||||
export function loadExtraExcludePatternsFromEnv(
|
||||
env: Record<string, string | undefined> = process.env,
|
||||
): string[] {
|
||||
const extraExcludeFile = env.OPENCLAW_VITEST_EXTRA_EXCLUDE_FILE?.trim();
|
||||
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);
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
...base,
|
||||
test: {
|
||||
...baseTest,
|
||||
include: unitTestIncludePatterns,
|
||||
exclude: [...exclude, ...unitTestAdditionalExcludePatterns],
|
||||
exclude: [
|
||||
...new Set([
|
||||
...exclude,
|
||||
...unitTestAdditionalExcludePatterns,
|
||||
...loadExtraExcludePatternsFromEnv(),
|
||||
]),
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user