diff --git a/extensions/browser/src/browser/output-directories.test.ts b/extensions/browser/src/browser/output-directories.test.ts index 50df0f168a5..3bff524355c 100644 --- a/extensions/browser/src/browser/output-directories.test.ts +++ b/extensions/browser/src/browser/output-directories.test.ts @@ -14,7 +14,14 @@ async function withTempDir(run: (tempDir: string) => Promise): Promise } async function expectPathMissing(targetPath: string): Promise { - await expect(fs.access(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); + let error: unknown; + try { + await fs.access(targetPath); + } catch (caught) { + error = caught; + } + expect(error).toBeInstanceOf(Error); + expect((error as NodeJS.ErrnoException).code).toBe("ENOENT"); } describe("ensureOutputDirectory", () => { diff --git a/extensions/browser/src/browser/pw-tools-core.waits-next-download-saves-it.test.ts b/extensions/browser/src/browser/pw-tools-core.waits-next-download-saves-it.test.ts index d11a4fd597b..8078c689108 100644 --- a/extensions/browser/src/browser/pw-tools-core.waits-next-download-saves-it.test.ts +++ b/extensions/browser/src/browser/pw-tools-core.waits-next-download-saves-it.test.ts @@ -104,7 +104,14 @@ describe("pw-tools-core", () => { } async function expectPathMissing(targetPath: string): Promise { - await expect(fs.access(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); + let error: unknown; + try { + await fs.access(targetPath); + } catch (caught) { + error = caught; + } + expect(error).toBeInstanceOf(Error); + expect((error as NodeJS.ErrnoException).code).toBe("ENOENT"); } function createDownloadEventHarness() { diff --git a/extensions/memory-wiki/src/compile.test.ts b/extensions/memory-wiki/src/compile.test.ts index a2326e06ce5..c85d5be4861 100644 --- a/extensions/memory-wiki/src/compile.test.ts +++ b/extensions/memory-wiki/src/compile.test.ts @@ -27,7 +27,14 @@ describe("compileMemoryWikiVault", () => { } async function expectPathMissing(targetPath: string): Promise { - await expect(fs.access(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); + let error: unknown; + try { + await fs.access(targetPath); + } catch (caught) { + error = caught; + } + expect(error).toBeInstanceOf(Error); + expect((error as NodeJS.ErrnoException).code).toBe("ENOENT"); } function expectDigestPage(pages: T[], pagePath: string): T {