Files
bot/vitest.e2e.config.ts
zeekay 21c07d9112 Rename OPENCLAW_* env vars to BOT_*
The codebase already had 663 BOT_* env-var refs from a partial migration
(BOT_CONFIG_PATH, BOT_SHELL, BOT_GATEWAY_BIND, …). Finish the rename:
every remaining OPENCLAW_ prefix becomes BOT_, unifying the env-var
surface on a single brand-neutral prefix.

3493 occurrences across 684 files (src/, test/, extensions/, apps/*/,
docs/, scripts/, infra configs). Clean break — no backwards-compat
reads. Users with existing OPENCLAW_* exports need to rename those.

Out of scope (separate change):
  - the ai.openclaw.android.* Java package (partial migration to
    ai.hanzo.bot.android.* already in place; finishing it requires
    moving files + AndroidManifest + applicationId + signing)
  - __openclaw__/ HTTP path prefix served by the gateway
2026-05-11 15:40:59 -07:00

33 lines
1.3 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;
// Keep e2e runs deterministic and cheap by default; callers can still override via BOT_E2E_WORKERS.
const defaultWorkers = isCI ? Math.min(2, Math.max(1, Math.floor(cpuCount * 0.25))) : 1;
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,
},
});