fix: materialize stale runtime mirror symlinks · openclaw/openclaw@566295c
steipete
·
2026-04-27
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -240,6 +240,30 @@ describe("installBundledRuntimeDeps", () => {
|
240 | 240 | expect(fs.readFileSync(chunkPath, "utf8")).toContain("same-file"); |
241 | 241 | }); |
242 | 242 | |
| 243 | +it("replaces stale mirror symlinks when materializing chunks", () => { |
| 244 | +const tempDir = makeTempDir(); |
| 245 | +const sourcePath = path.join(tempDir, "dist", "accounts.js"); |
| 246 | +const targetPath = path.join(tempDir, "stage", "dist", "accounts.js"); |
| 247 | +fs.mkdirSync(path.dirname(sourcePath), { recursive: true }); |
| 248 | +fs.mkdirSync(path.dirname(targetPath), { recursive: true }); |
| 249 | +fs.writeFileSync( |
| 250 | +sourcePath, |
| 251 | +[ |
| 252 | +`//#region extensions/slack/src/accounts.ts`, |
| 253 | +`export const marker = "source";`, |
| 254 | +`//#endregion`, |
| 255 | +"", |
| 256 | +].join("\n"), |
| 257 | +"utf8", |
| 258 | +); |
| 259 | +fs.symlinkSync(sourcePath, targetPath, "file"); |
| 260 | + |
| 261 | +materializeBundledRuntimeMirrorDistFile(sourcePath, targetPath); |
| 262 | + |
| 263 | +expect(fs.lstatSync(targetPath).isSymbolicLink()).toBe(false); |
| 264 | +expect(fs.readFileSync(targetPath, "utf8")).toContain("source"); |
| 265 | +}); |
| 266 | + |
243 | 267 | it("uses a real write probe for runtime dependency roots", () => { |
244 | 268 | const accessSpy = vi.spyOn(fs, "accessSync").mockImplementation(() => undefined); |
245 | 269 | const mkdirSpy = vi.spyOn(fs, "mkdtempSync").mockImplementation(() => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。