mirror of
https://github.com/hanzoai/bot.git
synced 2026-11-01 18:02:28 +00:00
Squash merge of 1,462 upstream commits with openclaw→hanzo-bot naming transforms applied. Conflicts resolved favoring our main branch to preserve existing customizations. Key upstream additions: - iOS Security Stack (concurrency locks, runtime guards, TTS fallback) - Discord CDN hostname allowlisting for SSRF protection - Discord mention handling improvements - Various bug fixes and stability improvements
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import os from "node:os";
|
|
import { defineConfig } from "vitest/config";
|
|
import baseConfig from "./vitest.config.ts";
|
|
|
|
const base = baseConfig as unknown as Record<string, unknown>;
|
|
const isCI = process.env.CI === "true" || process.env.GITHUB_ACTIONS === "true";
|
|
const cpuCount = os.cpus().length;
|
|
const defaultWorkers = isCI
|
|
? Math.min(4, Math.max(2, Math.floor(cpuCount * 0.5)))
|
|
: Math.min(8, Math.max(4, Math.floor(cpuCount * 0.6)));
|
|
const requestedWorkers = Number.parseInt(process.env.BOT_E2E_WORKERS ?? "", 10);
|
|
const e2eWorkers =
|
|
Number.isFinite(requestedWorkers) && requestedWorkers > 0
|
|
? Math.min(16, requestedWorkers)
|
|
: defaultWorkers;
|
|
const verboseE2E = process.env.BOT_E2E_VERBOSE === "1";
|
|
|
|
const baseTest = (baseConfig as { test?: { exclude?: string[] } }).test ?? {};
|
|
const exclude = (baseTest.exclude ?? []).filter((p) => p !== "**/*.e2e.test.ts");
|
|
|
|
export default defineConfig({
|
|
...base,
|
|
test: {
|
|
...baseTest,
|
|
// vmForks reuses VM contexts in ways that can leak module state/mocks across
|
|
// files for our e2e harnesses. Use process forks for deterministic isolation.
|
|
pool: "forks",
|
|
maxWorkers: e2eWorkers,
|
|
silent: !verboseE2E,
|
|
include: ["test/**/*.e2e.test.ts", "src/**/*.e2e.test.ts"],
|
|
exclude,
|
|
},
|
|
});
|