






















11// Create Dmg tests cover create dmg script behavior.
22import { spawnSync } from "node:child_process";
3-import { chmodSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3+import {
4+chmodSync,
5+existsSync,
6+mkdirSync,
7+mkdtempSync,
8+readFileSync,
9+rmSync,
10+writeFileSync,
11+} from "node:fs";
412import { tmpdir } from "node:os";
513import path from "node:path";
614import { afterEach, describe, expect, it } from "vitest";
@@ -215,6 +223,23 @@ describe.runIf(process.platform === "darwin")("create-dmg ownership boundaries",
215223expect(log).not.toContain(sibling);
216224});
217225226+it("creates a caller-provided output directory before finalizing the DMG", () => {
227+const app = makeValidApp();
228+const root = mkdtempSync(path.join(tmpdir(), "openclaw-create-dmg-output-"));
229+tempDirs.push(root);
230+const outputDir = path.join(root, "nested", "artifacts");
231+const output = path.join(outputDir, "OpenClaw.dmg");
232+const tools = makeFakeDmgTools();
233+234+const result = runScript([app, output], tools.env);
235+236+expect(result.status).toBe(0);
237+expect(existsSync(outputDir)).toBe(true);
238+expect(readFileSync(output, "utf8")).toBe("converted");
239+const log = readFileSync(tools.hdiutilLog, "utf8");
240+expect(log).toContain(`${outputDir}${path.sep}.openclaw-dmg.`);
241+});
242+218243it("preserves an existing output when image creation fails", () => {
219244const app = makeValidApp();
220245const outputDir = mkdtempSync(path.join(tmpdir(), "openclaw-create-dmg-output-"));
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。