fix: environment edge case launcher regression (#74696) · openclaw/openclaw@9177fab
clawsweeper
·
2026-04-30
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -201,6 +201,32 @@ describe("openclaw launcher", () => {
|
201 | 201 | expect(result.stdout).toContain(path.join(".node-compile-cache", "openclaw", "2026.4.29")); |
202 | 202 | }); |
203 | 203 | |
| 204 | +it("falls back to the default packaged launcher compile cache when NODE_COMPILE_CACHE is empty", async () => { |
| 205 | +const fixtureRoot = await makeLauncherFixture(fixtureRoots); |
| 206 | +const runCwd = makeTempDir(fixtureRoots, "openclaw-launcher-cwd-"); |
| 207 | +await fs.writeFile(path.join(fixtureRoot, "package.json"), '{"version":"2026.4.29"}\n'); |
| 208 | +await fs.writeFile( |
| 209 | +path.join(fixtureRoot, "dist", "entry.js"), |
| 210 | +[ |
| 211 | +'import module from "node:module";', |
| 212 | +'process.stdout.write(module.getCompileCacheDir?.() ?? "cache:disabled");', |
| 213 | +].join("\n"), |
| 214 | +"utf8", |
| 215 | +); |
| 216 | + |
| 217 | +const result = spawnSync(process.execPath, [path.join(fixtureRoot, "openclaw.mjs")], { |
| 218 | +cwd: runCwd, |
| 219 | +env: launcherEnv({ |
| 220 | +NODE_COMPILE_CACHE: "", |
| 221 | +}), |
| 222 | +encoding: "utf8", |
| 223 | +}); |
| 224 | + |
| 225 | +expect(result.status).toBe(0); |
| 226 | +expect(result.stdout).toContain(path.join("node-compile-cache", "openclaw", "2026.4.29")); |
| 227 | +expect(result.stdout).not.toContain(path.join(runCwd, "openclaw")); |
| 228 | +}); |
| 229 | + |
204 | 230 | it("enables compile cache for packaged launchers", async () => { |
205 | 231 | const fixtureRoot = await makeLauncherFixture(fixtureRoots); |
206 | 232 | await addCompileCacheProbe(fixtureRoot); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。