-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Changing url does not work with Jest #1700
Copy link
Copy link
Closed
Labels
Description
I'm trying to change the window url in my Jest specs and it throws an error. Not sure if this is an issue with the way that Jest has configured jsdom, or a problem with jsdom. A small example:
import jsdom from 'jsdom';
it('works', () => {
jsdom.changeURL(window, 'https://example.com?foo=butts')
});I run it like:
$ jest --config config/jest.json spec/js/my_test.jsAnd get an error:
TypeError: Cannot set property '_URL' of undefined
at Object.<anonymous>.exports.changeURL (node_modules/jsdom/lib/jsdom.js:64:12)
at Object.<anonymous> (spec/js/my_spec.js:6:45)
Not really much in the way of custom configuration on our part when it comes to Jest. Using jsdom@9.9.1 and jest@17.0.3.
Reactions are currently unavailable