| 54 | } |
| 55 | |
| 56 | function installFsMocks({ existing, dirs }: FsMockOptions) { |
| 57 | vi.doMock("node:fs", () => ({ |
| 58 | existsSync: (p: string) => existing.has(p), |
| 59 | readdirSync: (p: string) => { |
| 60 | const entries = dirs?.[p]; |
| 61 | if (!entries) throw new Error(`ENOENT: readdirSync mock had no entry for ${p}`); |
| 62 | return entries; |
| 63 | }, |
| 64 | rmSync: () => {}, |
| 65 | })); |
| 66 | vi.doMock("node:os", () => ({ |
| 67 | homedir: () => FAKE_HOME, |
| 68 | platform: () => "linux", |
| 69 | arch: () => "x64", |
| 70 | })); |
| 71 | } |
| 72 | |
| 73 | function installPuppeteerBrowsersMock( |
| 74 | opts: { |