


























@@ -5,14 +5,20 @@ import { tmpdir } from "node:os";
55import path from "node:path";
66import { describe, expect, it } from "vitest";
778-function runHelper(script: string, ...args: string[]) {
9-return spawnSync(process.execPath, [script, ...args], {
8+function runHelper(script: string, ...args: Array<string | Record<string, string>>) {
9+const maybeEnv = args.at(-1);
10+const env =
11+maybeEnv && typeof maybeEnv === "object"
12+ ? (args.pop() as unknown as Record<string, string>)
13+ : {};
14+return spawnSync(process.execPath, [script, ...(args as string[])], {
1015cwd: process.cwd(),
1116encoding: "utf8",
1217env: {
1318 ...process.env,
1419GH_FORCE_TTY: "0",
1520NO_COLOR: "1",
21+ ...env,
1622},
1723});
1824}
@@ -36,6 +42,26 @@ describe("Docker E2E helper CLIs", () => {
3642expect(result.stderr).not.toContain("at file:");
3743});
384445+it("rejects oversized scheduler helper JSON artifacts without a Node stack trace", () => {
46+const root = mkdtempSync(`${tmpdir()}/openclaw-docker-e2e-helper-`);
47+try {
48+const file = path.join(root, "summary.json");
49+writeFileSync(file, `${JSON.stringify({ filler: "x".repeat(128) })}\n`, "utf8");
50+51+const result = runHelper("scripts/docker-e2e.mjs", "failed-reruns", file, {
52+OPENCLAW_DOCKER_E2E_JSON_ARTIFACT_MAX_BYTES: "64",
53+});
54+55+expect(result.status).toBe(1);
56+expect(result.stdout).toBe("");
57+expect(result.stderr).toContain("JSON artifact exceeded 64 bytes");
58+expect(result.stderr).not.toContain("Error:");
59+expect(result.stderr).not.toContain("at file:");
60+} finally {
61+rmSync(root, { force: true, recursive: true });
62+}
63+});
64+3965it("prints timings help without treating --help as an artifact path", () => {
4066const result = runHelper("scripts/docker-e2e-timings.mjs", "--help");
4167@@ -56,6 +82,26 @@ describe("Docker E2E helper CLIs", () => {
5682expect(result.stderr).not.toContain("at file:");
5783});
588485+it("rejects oversized timing JSON artifacts without a Node stack trace", () => {
86+const root = mkdtempSync(`${tmpdir()}/openclaw-docker-e2e-timings-`);
87+try {
88+const file = path.join(root, "summary.json");
89+writeFileSync(file, `${JSON.stringify({ filler: "x".repeat(128) })}\n`, "utf8");
90+91+const result = runHelper("scripts/docker-e2e-timings.mjs", file, {
92+OPENCLAW_DOCKER_E2E_JSON_ARTIFACT_MAX_BYTES: "64",
93+});
94+95+expect(result.status).toBe(1);
96+expect(result.stdout).toBe("");
97+expect(result.stderr).toContain("JSON artifact exceeded 64 bytes");
98+expect(result.stderr).not.toContain("Error:");
99+expect(result.stderr).not.toContain("at file:");
100+} finally {
101+rmSync(root, { force: true, recursive: true });
102+}
103+});
104+59105it("rejects missing timings limits without a Node stack trace", () => {
60106const result = runHelper("scripts/docker-e2e-timings.mjs", "summary.json", "--limit");
61107此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。