Tests: pin full shard worker budget

This commit is contained in:
Peter Steinberger
2026-04-07 15:07:33 +01:00
parent dfe1ef9041
commit da300c12e3
2 changed files with 15 additions and 1 deletions

View File

@@ -1,12 +1,22 @@
import { createScopedVitestConfig } from "./vitest.scoped-config.ts";
export function createCronVitestConfig(env?: Record<string, string | undefined>) {
return createScopedVitestConfig(["src/cron/**/*.test.ts"], {
const config = createScopedVitestConfig(["src/cron/**/*.test.ts"], {
dir: "src",
env,
name: "cron",
passWithNoTests: true,
});
config.test = {
...config.test,
maxWorkers: 1,
fileParallelism: false,
sequence: {
...config.test?.sequence,
groupOrder: 1,
},
};
return config;
}
export default createCronVitestConfig();

View File

@@ -2,6 +2,10 @@ import { defineConfig } from "vitest/config";
import { sharedVitestConfig } from "./vitest.shared.config.ts";
export function createProjectShardVitestConfig(projects: readonly string[]) {
const maxWorkers = sharedVitestConfig.test.maxWorkers;
if (!process.env.OPENCLAW_VITEST_MAX_WORKERS && typeof maxWorkers === "number") {
process.env.OPENCLAW_VITEST_MAX_WORKERS = String(maxWorkers);
}
return defineConfig({
...sharedVitestConfig,
test: {