fix(mac): reject build-and-run wrapper args · openclaw/openclaw@63ac2e2
vincentkoc
·
2026-06-21
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -108,9 +108,33 @@ afterEach(() => {
|
108 | 108 | }); |
109 | 109 | |
110 | 110 | describe("scripts/build-and-run-mac.sh", () => { |
| 111 | +it("prints help before build or launch side effects", () => { |
| 112 | +const result = spawnSync("bash", [scriptPath, "--help"], { |
| 113 | +cwd: process.cwd(), |
| 114 | +encoding: "utf8", |
| 115 | +}); |
| 116 | + |
| 117 | +expect(result.status).toBe(0); |
| 118 | +expect(result.stdout).toContain("Usage: build-and-run-mac.sh"); |
| 119 | +expect(result.stdout).toContain("Build, stop, and relaunch"); |
| 120 | +expect(result.stderr).toBe(""); |
| 121 | +}); |
| 122 | + |
| 123 | +it("rejects unknown options before build or launch side effects", () => { |
| 124 | +const result = spawnSync("bash", [scriptPath, "--wat"], { |
| 125 | +cwd: process.cwd(), |
| 126 | +encoding: "utf8", |
| 127 | +}); |
| 128 | + |
| 129 | +expect(result.status).toBe(1); |
| 130 | +expect(result.stdout).toBe(""); |
| 131 | +expect(result.stderr.trim()).toBe("ERROR: Unknown build-and-run-mac option: --wat"); |
| 132 | +}); |
| 133 | + |
111 | 134 | it("keeps launch logs isolated unless an explicit log path is provided", () => { |
112 | 135 | const script = readFileSync(scriptPath, "utf8"); |
113 | 136 | |
| 137 | +expect(script).toContain('cd "$APP_DIR"'); |
114 | 138 | expect(script).toContain( |
115 | 139 | 'LOG_PATH="${OPENCLAW_MAC_RUN_LOG:-$(mktemp "${TMPDIR:-/tmp}/openclaw-${PRODUCT}.XXXXXX.log")}"', |
116 | 140 | ); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。