Skip to content

Commit 40385bb

Browse files
authored
test(e2e): isolate shared build artifacts (#120628)
1 parent 1beb963 commit 40385bb

3 files changed

Lines changed: 32 additions & 5 deletions

File tree

‎packages/ai/src/package.e2e.test.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,8 @@ describe("@openclaw/ai packed package", () => {
271271
}
272272
const tempDir = tempDirs.make("openclaw-ai-consumer-");
273273

274-
await runCommand(
275-
process.execPath,
276-
["scripts/tsdown-build.mjs", "--config", "tsdown.ai.config.ts"],
277-
{ cwd: repoRoot },
278-
);
274+
// The E2E global setup owns the exact-head build. Rebuilding this shared
275+
// package here can delete modules beneath concurrently running Gateways.
279276
const pack = await runNpmCommand(
280277
["pack", "--ignore-scripts", "--json", "--pack-destination", tempDir],
281278
packageRoot,

‎test/vitest/vitest.e2e.config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export default defineConfig({
3939
...baseTest,
4040
maxWorkers: e2eWorkers,
4141
silent: !verboseE2E,
42+
globalSetup: [resolveRepoRootPath("test/vitest/vitest.e2e.global-setup.ts")],
4243
setupFiles: [
4344
...new Set(
4445
[...(baseTest.setupFiles ?? []), "test/setup-openclaw-runtime.ts"].map(resolveRepoRootPath),
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Builds the shared CLI/package artifacts once before parallel E2E workers
2+
// start long-lived Gateway processes that import those artifacts lazily.
3+
import { execFile } from "node:child_process";
4+
import { promisify } from "node:util";
5+
6+
const execFileAsync = promisify(execFile);
7+
8+
export default async function setup() {
9+
await execFileAsync(process.execPath, ["scripts/run-node.mjs", "--version"], {
10+
cwd: process.cwd(),
11+
env: {
12+
...process.env,
13+
OPENCLAW_BUILD_PRIVATE_QA: "1",
14+
OPENCLAW_RUN_NODE_SKIP_DTS_BUILD: "0",
15+
},
16+
maxBuffer: 8 * 1024 * 1024,
17+
timeout: 300_000,
18+
});
19+
await execFileAsync(
20+
process.execPath,
21+
["scripts/tsdown-build.mjs", "--config", "tsdown.ai.config.ts"],
22+
{
23+
cwd: process.cwd(),
24+
env: process.env,
25+
maxBuffer: 8 * 1024 * 1024,
26+
timeout: 300_000,
27+
},
28+
);
29+
}

0 commit comments

Comments
 (0)