Software⏱️ 2 min read📅 2026-06-04

How to Fix: How to fix Error: Not implemented: navigation (except hash changes)

Error Not implemented: navigation (except hash changes) in Jest testing

Quick Answer: Update jsdom to the latest version, as this error is known to be fixed in newer versions. Run `npm install --save-dev @types/jsdom@~18.0.0` or `yarn add @types/jsdom@~18.0.0 --dev`

The error 'Not implemented: navigation (except hash changes)' occurs when using the `window.location.href` property in a testing environment, specifically with Jest and Node.js version v8.9.3.

This issue affects developers who are writing unit tests for applications that utilize client-side routing or dynamic URL manipulation.

⚠️ Common Causes

  • The primary cause of this error is the implementation of the `jsdom` library, which is used to simulate a browser environment in Node.js. In version v8.9.3 of Node.js, the `jsdom` library has not implemented full support for navigation events, including hash changes.
  • An alternative reason could be related to the specific testing framework or configuration being used, but this is less likely to be the cause.

🔧 Proven Troubleshooting Steps

Enabling Navigation Events in jsdom

  1. Step 1: Update the `jsdom` version to a recent stable release that supports navigation events.
  2. Step 2: Use the `--allow-same-origin` flag when running Jest tests, which allows `jsdom` to simulate more realistic browser behavior.

Using an Alternative Testing Library

  1. Step 1: Consider using a different testing library that provides better support for navigation events and client-side routing, such as `@jest-environment/jsdom-extended` or `@jest-environment/cjs-with-dom`.

🎯 Final Words

By following these steps, you should be able to resolve the 'Not implemented: navigation (except hash changes)' error in your Jest tests. Remember to update your `jsdom` version and consider using an alternative testing library if necessary.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions