diff --git a/src/auto-reply/reply.stage-sandbox-media.scp-remote-path.test.ts b/src/auto-reply/reply.stage-sandbox-media.scp-remote-path.test.ts index 2b01f6b263b..bae196277b1 100644 --- a/src/auto-reply/reply.stage-sandbox-media.scp-remote-path.test.ts +++ b/src/auto-reply/reply.stage-sandbox-media.scp-remote-path.test.ts @@ -66,7 +66,13 @@ function createRemoteContexts(remotePath: string) { } async function expectPathMissing(targetPath: string): Promise { - await expect(fs.stat(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); + let statError: unknown; + try { + await fs.stat(targetPath); + } catch (error) { + statError = error; + } + expect((statError as NodeJS.ErrnoException | undefined)?.code).toBe("ENOENT"); } describe("stageSandboxMedia scp remote paths", () => {