mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
test(e2e): isolate shared build artifacts (#120628)
(cherry picked from commit 40385bb5c1)
This commit is contained in:
committed by
Vincent Koc
parent
1b8b678690
commit
5021bc2f7c
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user