diff --git a/src/commands/backup.atomic.test.ts b/src/commands/backup.atomic.test.ts index 3f519f57fe1..baf38c1efba 100644 --- a/src/commands/backup.atomic.test.ts +++ b/src/commands/backup.atomic.test.ts @@ -55,6 +55,10 @@ describe("backupCreateCommand atomic archive write", () => { }; } + async function expectPathMissing(targetPath: string): Promise { + await expect(fs.access(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); + } + it("does not leave a partial final archive behind when tar creation fails", async () => { const { archiveDir, outputPath, runtime } = await prepareAtomicBackupScenario({ archivePrefix: "openclaw-backup-failure-", @@ -68,7 +72,7 @@ describe("backupCreateCommand atomic archive write", () => { }), ).rejects.toThrow(/disk full/i); - await expect(fs.access(outputPath)).rejects.toThrow(); + await expectPathMissing(outputPath); const remaining = await fs.readdir(archiveDir); expect(remaining).toEqual([]); } finally {