Comments (2)
Solve add the following code to jest.setup.js
Thanks for issue #58
jest.mock("next/dist/client/router", () => require("next-router-mock"));
jest.mock("next/dist/shared/lib/router-context", () => {
const { createContext } = require("react");
const router = require("next-router-mock").default;
const RouterContext = createContext(router);
return { RouterContext };
});
This code is quoted from the issue
from next-router-mock.
Closing as duplicate of #58
I'm still considering how to fix this.
from next-router-mock.
Related Issues (20)
- `next/link` not working with `passHref` HOT 1
- Next 13.4.20-canary.20 issue HOT 8
- MemoryRouterProvider url property does not work properly HOT 3
- Incorrect path in types
- With Next14, the path to the RouterContext seems to be wrong. HOT 2
- next/link not working with async HOT 2
- Modify the as param condition HOT 2
- configuring webpack alias in storybook, it doesn't to work in storybook test HOT 9
- `router.back` support HOT 4
- Any support planned for `next` version `13.2.x` ? HOT 3
- Add a changelog HOT 2
- In 0.9.3 test asserting `window.location.assign` fails HOT 1
- Is it possible to use dynamic routes with the MemoryRouterProvider for rendering in storybook? HOT 3
- dist folder auto-import inconsistencies HOT 2
- Using `next/link` with the locale property. HOT 1
- How to mock next router with jest `experimental-vm-modules` HOT 3
- router.push({ hash }) not triggering a re-render HOT 2
- Inconsistent useRouter behavior compared to the Next.js Router HOT 7
- Consider the skipTrailingSlashRedirect config HOT 1
- mocked next/link behavior seems inconsistenst with next/link from next.js when the `as` prop is used HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next-router-mock.