mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-11 17:21:13 +00:00
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import { defineProject } from "vitest/config";
|
|
import { loadPatternListFromEnv, narrowIncludePatternsForCli } from "./vitest.pattern-file.ts";
|
|
import { sharedVitestConfig } from "./vitest.shared.config.ts";
|
|
import { boundaryTestFiles } from "./vitest.unit-paths.mjs";
|
|
|
|
export function loadBoundaryIncludePatternsFromEnv(
|
|
env: Record<string, string | undefined> = process.env,
|
|
): string[] | null {
|
|
return loadPatternListFromEnv("OPENCLAW_VITEST_INCLUDE_FILE", env);
|
|
}
|
|
|
|
export function createBoundaryVitestConfig(
|
|
env: Record<string, string | undefined> = process.env,
|
|
argv: string[] = process.argv,
|
|
) {
|
|
const cliIncludePatterns = narrowIncludePatternsForCli(boundaryTestFiles, argv);
|
|
return defineProject({
|
|
...sharedVitestConfig,
|
|
test: {
|
|
...sharedVitestConfig.test,
|
|
name: "boundary",
|
|
include: loadBoundaryIncludePatternsFromEnv(env) ?? cliIncludePatterns ?? boundaryTestFiles,
|
|
...(cliIncludePatterns !== null ? { passWithNoTests: true } : {}),
|
|
setupFiles: sharedVitestConfig.test.setupFiles,
|
|
},
|
|
});
|
|
}
|
|
|
|
export default createBoundaryVitestConfig();
|