diff --git a/src/agents/auth-profiles/oauth-lock-path.test.ts b/src/agents/auth-profiles/oauth-lock-path.test.ts index b62f98e2d75..d64e87ecdee 100644 --- a/src/agents/auth-profiles/oauth-lock-path.test.ts +++ b/src/agents/auth-profiles/oauth-lock-path.test.ts @@ -6,7 +6,13 @@ import { captureEnv } from "../../test-utils/env.js"; import { resolveOAuthRefreshLockPath } from "./paths.js"; async function expectPathMissing(targetPath: string): Promise { - await expect(fs.stat(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); + try { + await fs.stat(targetPath); + } catch (error) { + expect((error as NodeJS.ErrnoException).code).toBe("ENOENT"); + return; + } + throw new Error(`Expected missing path: ${targetPath}`); } describe("resolveOAuthRefreshLockPath", () => {