diff --git a/src/infra/restart-sentinel.test.ts b/src/infra/restart-sentinel.test.ts index 15338547566..8c111907a65 100644 --- a/src/infra/restart-sentinel.test.ts +++ b/src/infra/restart-sentinel.test.ts @@ -30,6 +30,10 @@ async function withRestartSentinelStateDir(run: () => Promise): Promise { + await expect(fs.stat(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); +} + describe("restart sentinel", () => { it("writes and consumes a sentinel", async () => { await withRestartSentinelStateDir(async () => { @@ -69,7 +73,7 @@ describe("restart sentinel", () => { const read = await readRestartSentinel(); expect(read).toBeNull(); - await expect(fs.stat(filePath)).rejects.toThrow(); + await expectPathMissing(filePath); }); }); @@ -80,7 +84,7 @@ describe("restart sentinel", () => { await fs.writeFile(filePath, JSON.stringify({ version: 2, payload: null }), "utf-8"); await expect(readRestartSentinel()).resolves.toBeNull(); - await expect(fs.stat(filePath)).rejects.toThrow(); + await expectPathMissing(filePath); }); });