I just started to migrate from jest to vitest after migrating my app from cra to vite. I ran ainto an issue where I want to mock useParam hook of react-router-dom
Original code:
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'), // use actual for all non-hook parts
useParams: () => ({
taskId: 123,
}),
}));
I tried something like this:
vi.mock('react-router-dom', async () => ({
...vi.importActual('react-router-dom'), // use actual for all non-hook parts
useParams: () => ({
taskId: 123,
}),
}));
But it's not working?