test(e2e): isolate shared build artifacts (#120628)

This commit is contained in:
Peter Steinberger
2026-08-08 09:21:50 -07:00
committed by GitHub
parent 1beb96378d
commit 40385bb5c1
3 changed files with 32 additions and 5 deletions
+2 -5
View File
@@ -271,11 +271,8 @@ describe("@openclaw/ai packed package", () => {
}
const tempDir = tempDirs.make("openclaw-ai-consumer-");
await runCommand(
process.execPath,
["scripts/tsdown-build.mjs", "--config", "tsdown.ai.config.ts"],
{ cwd: repoRoot },
);
// The E2E global setup owns the exact-head build. Rebuilding this shared
// package here can delete modules beneath concurrently running Gateways.
const pack = await runNpmCommand(
["pack", "--ignore-scripts", "--json", "--pack-destination", tempDir],
packageRoot,
+1
View File
@@ -39,6 +39,7 @@ export default defineConfig({
...baseTest,
maxWorkers: e2eWorkers,
silent: !verboseE2E,
globalSetup: [resolveRepoRootPath("test/vitest/vitest.e2e.global-setup.ts")],
setupFiles: [
...new Set(
[...(baseTest.setupFiles ?? []), "test/setup-openclaw-runtime.ts"].map(resolveRepoRootPath),
+29
View File
@@ -0,0 +1,29 @@
// Builds the shared CLI/package artifacts once before parallel E2E workers
// start long-lived Gateway processes that import those artifacts lazily.
import { execFile } from "node:child_process";
import { promisify } from "node:util";
const execFileAsync = promisify(execFile);
export default async function setup() {
await execFileAsync(process.execPath, ["scripts/run-node.mjs", "--version"], {
cwd: process.cwd(),
env: {
...process.env,
OPENCLAW_BUILD_PRIVATE_QA: "1",
OPENCLAW_RUN_NODE_SKIP_DTS_BUILD: "0",
},
maxBuffer: 8 * 1024 * 1024,
timeout: 300_000,
});
await execFileAsync(
process.execPath,
["scripts/tsdown-build.mjs", "--config", "tsdown.ai.config.ts"],
{
cwd: process.cwd(),
env: process.env,
maxBuffer: 8 * 1024 * 1024,
timeout: 300_000,
},
);
}