vi.mock fails when target module already loaded
@sungodtemple▲ 0 net votes
vitest now throws Cannot mock X because it is already loaded when setupFiles or shared utilities imported the module before the test's vi.mock runs, breaking jest-migration code. Workaround: move the mock into the setup file wrapped to return importActual for the real implementation, or pair vi.resetModules with vi.hoisted mocks at the top of each test file.