





















@@ -1030,100 +1030,95 @@ describe("runGatewayUpdate", () => {
10301030expect(cleanupStep?.stderrTail ?? "").toContain("fallback cleanup removed preflight tree");
10311031});
103210321033-it("adds heap headroom to windows pnpm build steps during dev updates", async () => {
1033+it("adds heap headroom to pnpm build steps during dev updates", async () => {
10341034await setupGitPackageManagerFixture();
10351035const upstreamSha = "upstream123";
10361036const buildNodeOptions: string[] = [];
10371037const doctorNodePath = await resolveStableNodePath(process.execPath);
10381038const doctorCommand = `${doctorNodePath} ${path.join(tempDir, "openclaw.mjs")} doctor --non-interactive --fix`;
1039-const platformSpy = vi.spyOn(process, "platform", "get").mockReturnValue("win32");
104010391041-try {
1042-const runCommand = async (
1043-argv: string[],
1044-options?: { env?: NodeJS.ProcessEnv; cwd?: string; timeoutMs?: number },
1045-) => {
1046-const key = argv.join(" ");
1040+const runCommand = async (
1041+argv: string[],
1042+options?: { env?: NodeJS.ProcessEnv; cwd?: string; timeoutMs?: number },
1043+) => {
1044+const key = argv.join(" ");
104710451048-if (key === `git -C ${tempDir} rev-parse --show-toplevel`) {
1049-return { stdout: tempDir, stderr: "", code: 0 };
1050-}
1051-if (key === `git -C ${tempDir} rev-parse HEAD`) {
1052-return { stdout: "abc123", stderr: "", code: 0 };
1053-}
1054-if (key === `git -C ${tempDir} rev-parse --abbrev-ref HEAD`) {
1055-return { stdout: "main", stderr: "", code: 0 };
1056-}
1057-if (key === `git -C ${tempDir} status --porcelain -- :!dist/control-ui/`) {
1058-return { stdout: "", stderr: "", code: 0 };
1059-}
1060-if (key === `git -C ${tempDir} rev-parse --abbrev-ref --symbolic-full-name @{upstream}`) {
1061-return { stdout: "origin/main", stderr: "", code: 0 };
1062-}
1063-if (key === `git -C ${tempDir} fetch --all --prune --tags`) {
1064-return { stdout: "", stderr: "", code: 0 };
1065-}
1066-if (key === `git -C ${tempDir} rev-parse @{upstream}`) {
1067-return { stdout: upstreamSha, stderr: "", code: 0 };
1068-}
1069-if (key === `git -C ${tempDir} rev-list --max-count=10 ${upstreamSha}`) {
1070-return { stdout: `${upstreamSha}\n`, stderr: "", code: 0 };
1071-}
1072-if (key === "pnpm --version") {
1073-return { stdout: "10.0.0", stderr: "", code: 0 };
1074-}
1075-if (
1076-key.startsWith(`git -C ${tempDir} worktree add --detach /tmp/`) &&
1077-key.endsWith(` ${upstreamSha}`) &&
1078-preflightPrefixPattern.test(key)
1079-) {
1080-return { stdout: `HEAD is now at ${upstreamSha}`, stderr: "", code: 0 };
1081-}
1082-if (
1083-key.startsWith("git -C /tmp/") &&
1084-preflightPrefixPattern.test(key) &&
1085-key.includes(" checkout --detach ") &&
1086-key.endsWith(upstreamSha)
1087-) {
1088-return { stdout: "", stderr: "", code: 0 };
1089-}
1090-if (
1091-key === "pnpm install --ignore-scripts" ||
1092-key === "pnpm lint" ||
1093-key === "pnpm ui:build"
1094-) {
1095-return { stdout: "", stderr: "", code: 0 };
1096-}
1097-if (key === "pnpm build") {
1098-buildNodeOptions.push(options?.env?.NODE_OPTIONS ?? "");
1099-return { stdout: "", stderr: "", code: 0 };
1100-}
1101-if (
1102-key.startsWith(`git -C ${tempDir} worktree remove --force /tmp/`) &&
1103-preflightPrefixPattern.test(key)
1104-) {
1105-return { stdout: "", stderr: "", code: 0 };
1106-}
1107-if (key === `git -C ${tempDir} worktree prune`) {
1108-return { stdout: "", stderr: "", code: 0 };
1109-}
1110-if (key === `git -C ${tempDir} rebase ${upstreamSha}`) {
1111-return { stdout: "", stderr: "", code: 0 };
1112-}
1113-if (key === doctorCommand) {
1114-return { stdout: "", stderr: "", code: 0 };
1115-}
1046+if (key === `git -C ${tempDir} rev-parse --show-toplevel`) {
1047+return { stdout: tempDir, stderr: "", code: 0 };
1048+}
1049+if (key === `git -C ${tempDir} rev-parse HEAD`) {
1050+return { stdout: "abc123", stderr: "", code: 0 };
1051+}
1052+if (key === `git -C ${tempDir} rev-parse --abbrev-ref HEAD`) {
1053+return { stdout: "main", stderr: "", code: 0 };
1054+}
1055+if (key === `git -C ${tempDir} status --porcelain -- :!dist/control-ui/`) {
11161056return { stdout: "", stderr: "", code: 0 };
1117-};
1057+}
1058+if (key === `git -C ${tempDir} rev-parse --abbrev-ref --symbolic-full-name @{upstream}`) {
1059+return { stdout: "origin/main", stderr: "", code: 0 };
1060+}
1061+if (key === `git -C ${tempDir} fetch --all --prune --tags`) {
1062+return { stdout: "", stderr: "", code: 0 };
1063+}
1064+if (key === `git -C ${tempDir} rev-parse @{upstream}`) {
1065+return { stdout: upstreamSha, stderr: "", code: 0 };
1066+}
1067+if (key === `git -C ${tempDir} rev-list --max-count=10 ${upstreamSha}`) {
1068+return { stdout: `${upstreamSha}\n`, stderr: "", code: 0 };
1069+}
1070+if (key === "pnpm --version") {
1071+return { stdout: "10.0.0", stderr: "", code: 0 };
1072+}
1073+if (
1074+key.startsWith(`git -C ${tempDir} worktree add --detach /tmp/`) &&
1075+key.endsWith(` ${upstreamSha}`) &&
1076+preflightPrefixPattern.test(key)
1077+) {
1078+return { stdout: `HEAD is now at ${upstreamSha}`, stderr: "", code: 0 };
1079+}
1080+if (
1081+key.startsWith("git -C /tmp/") &&
1082+preflightPrefixPattern.test(key) &&
1083+key.includes(" checkout --detach ") &&
1084+key.endsWith(upstreamSha)
1085+) {
1086+return { stdout: "", stderr: "", code: 0 };
1087+}
1088+if (
1089+key === "pnpm install --ignore-scripts" ||
1090+key === "pnpm lint" ||
1091+key === "pnpm ui:build"
1092+) {
1093+return { stdout: "", stderr: "", code: 0 };
1094+}
1095+if (key === "pnpm build") {
1096+buildNodeOptions.push(options?.env?.NODE_OPTIONS ?? "");
1097+return { stdout: "", stderr: "", code: 0 };
1098+}
1099+if (
1100+key.startsWith(`git -C ${tempDir} worktree remove --force /tmp/`) &&
1101+preflightPrefixPattern.test(key)
1102+) {
1103+return { stdout: "", stderr: "", code: 0 };
1104+}
1105+if (key === `git -C ${tempDir} worktree prune`) {
1106+return { stdout: "", stderr: "", code: 0 };
1107+}
1108+if (key === `git -C ${tempDir} rebase ${upstreamSha}`) {
1109+return { stdout: "", stderr: "", code: 0 };
1110+}
1111+if (key === doctorCommand) {
1112+return { stdout: "", stderr: "", code: 0 };
1113+}
1114+return { stdout: "", stderr: "", code: 0 };
1115+};
111811161119- const result = await runWithCommand(runCommand, { channel: "dev" });
1117+const result = await runWithCommand(runCommand, { channel: "dev" });
112011181121-expect(result.status).toBe("ok");
1122-expect(buildNodeOptions).toHaveLength(2);
1123-expect(buildNodeOptions).toEqual(["--max-old-space-size=4096", "--max-old-space-size=4096"]);
1124-} finally {
1125-platformSpy.mockRestore();
1126-}
1119+expect(result.status).toBe("ok");
1120+expect(buildNodeOptions).toHaveLength(2);
1121+expect(buildNodeOptions).toEqual(["--max-old-space-size=4096", "--max-old-space-size=4096"]);
11271122});
11281123it("pins dev updates to an explicit target ref when requested", async () => {
11291124await setupGitPackageManagerFixture();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。