mirror of
https://github.com/openclaw/openclaw.git
synced 2026-11-01 04:58:23 +00:00
* feat(dev): default local tests and CLI to pinned Bun * fix(test): preserve Bun launch and report contracts in CI * fix(test): preserve workflow-provisioned Bun in CI * fix(test): report pinned Bun staging failure causes
27 lines
791 B
TypeScript
27 lines
791 B
TypeScript
import { isCiEnvironment, resolvePinnedBun } from "./pinned-bun.mts";
|
|
|
|
let fallbackReported = false;
|
|
|
|
export function resolveTestRuntime(env: NodeJS.ProcessEnv = process.env): "node" | "bun" {
|
|
const runtime = env.OPENCLAW_VITEST_RUNTIME?.trim();
|
|
if (runtime) {
|
|
if (runtime !== "node" && runtime !== "bun") {
|
|
throw new Error(`Invalid OPENCLAW_VITEST_RUNTIME: ${runtime}; expected node or bun`);
|
|
}
|
|
return runtime;
|
|
}
|
|
if (isCiEnvironment(env)) {
|
|
return "node";
|
|
}
|
|
const bun = resolvePinnedBun(env);
|
|
if (bun.command) {
|
|
return "bun";
|
|
}
|
|
if (!fallbackReported) {
|
|
fallbackReported = true;
|
|
console.error(
|
|
`[openclaw] Bun fork unavailable (${bun.reason}); using Node. Set OPENCLAW_VITEST_RUNTIME=node to silence.`,
|
|
);
|
|
}
|
|
return "node";
|
|
}
|