DEV Community

Mayank
Mayank

Posted on

How to mock next/router for unit testing with vitest?

When trying to write simple tests for out Next.js app that uses useRouter() hook, vitest starts throwing errors.

Looking for ways to mock next/router for unit testing with vitest.

Top comments (0)