Error: Not implemented: navigation
See original GitHub issueAfter recent upgrade jest (which uses jsdom in background) from version 21.2.0 to 22.0.6 I have started getting error: "Error: Not implemented:" navigation
My code relies on window.location and I use in tests:
beforeEach(() => {
window.location.href = `/ms/submission/?mybib`;
window.location.search = '?mybib';
});
Is there a way to define a value of window.location.search using new version of jsdom?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:77
- Comments:57 (7 by maintainers)
Top Results From Across the Web
How to fix Error: Not implemented: navigation (except hash ...
The reason JSDOM complains about the Error: Not implemented: navigation (except hash changes) is because JSDOM does not implement methods ...
Read more >X" on Jest + JSDOM for component unit tests - Raul Melo
In this post I explain how to fix "Not implemented" problems while using Jest + JSDOM for component unit test.
Read more >Jest error - Not implemented: navigation (except hash ...
Coding example for the question Jest error - Not implemented: navigation (except hash changes) when click event is triggered on an anchor element-Reactjs....
Read more >Tip! Mock jsdom location with Jest - DEV Community ā ā
You would receive an warning like below in case of jest running through above code: Error: Not implemented: navigation (except hash changes)Ā ...
Read more >Assert window.location properties with Jest and jsdom - Notes
Error: Not implemented: navigation (except hash changes). That's fair enough! Adding navigation would be a big increase in scope for jsdom,Ā ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Allow me to post the answer to my own question š I simply replace the usages of
window.location = url;andwindow.location.href = url;withand then in my tests I did:
Works like a charm - hope it can be of help to someone else š
If you donāt want to change your code to use
location.assign- this seems to work with JSDom 11 and 13 (though thereās a chance JSDom might break it in the futureā¦)