You should be able to, if you have at the top: vi.mock('node:fs', () => { return { existsSync: vi.fn(), }; });
2 Matching Annotations
- Last 7 days
-
-
-
All vi.mock calls are placed at the top of the file, and it's the first thing that's getting called. To change implementation for different tests, you can do: vi.spyOn(fs, 'existsSync').mockImplementation(() => { // new implementation })
-