Last active
January 12, 2026 04:55
-
-
Save cpojer/e66f9a082021a82230f2595a6027f161 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/lib/jsdom/browser/Window.js b/lib/jsdom/browser/Window.js | |
| index 52d011cae61c3688ec64baa5cec411d55edbda9d..298d7ec8d2cc1ea5e974262b978e6041389900f7 100644 | |
| --- a/lib/jsdom/browser/Window.js | |
| +++ b/lib/jsdom/browser/Window.js | |
| @@ -507,8 +507,8 @@ function installOwnProperties(window, options) { | |
| // [LegacyUnforgeable]: | |
| window: { configurable: false }, | |
| document: { configurable: false }, | |
| - location: { configurable: false }, | |
| - top: { configurable: false } | |
| + location: { configurable: true }, | |
| + top: { configurable: false }, | |
| }); |
FYI this no longer seems to work on jsdom 27.4.0 (of course line numbers have changed, but I mean the patch in general doesn't work anymore). Despite setting configurable to true, I get Error: Not implemented: navigation (except hash changes).
Edit: Never mind. My issue was that I had a direct dependency against jsdom. I removed it from my own package and just use jest-environment-jsdom which internally depends on jsdom.
Then you need to create this patch file patches/jest-environment-jsdom++jsdom+26.1.0.patch
(This will patch the jsdom that is inside jest-environment-jsdom)
diff --git a/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/browser/Window.js b/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/browser/Window.js
index 52d011c..5b29f5a 100644
--- a/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/browser/Window.js
+++ b/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/browser/Window.js
@@ -507,7 +507,7 @@ function installOwnProperties(window, options) {
// [LegacyUnforgeable]:
window: { configurable: false },
document: { configurable: false },
- location: { configurable: false },
+ location: { configurable: true },
top: { configurable: false }
});
And run npx patch-package
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe its handy to keep every version isolated, not many people need to stay latest. Thank you for your work! Hopefully something better will arrive with Jest :)