/../app/node_modules/jsdom/lib/jsdom/living/window/History-impl.js:87
throw new DOMException(DOMException.SECURITY_ERR, `Could not parse url argument "${url}" to ${methodName} ` +
^
SecurityError
at HistoryImpl._sharedPushAndReplaceState (/../app/node_modules/jsdom/lib/jsdom/living/window/History-impl.js:87:15)
at HistoryImpl.replaceState (/../app/node_modules/jsdom/lib/jsdom/living/window/History-impl.js:72:10)
at History.replaceState (/../app/node_modules/jsdom/lib/jsdom/living/generated/History.js:89:58)
at getCurrentLocation (/../app/node_modules/history/lib/createBrowserHistory.js:60:39)
at Object.listen (/../app/node_modules/history/lib/createHistory.js:106:23)
at Object.listen (/../app/node_modules/history/lib/createDOMHistory.js:31:20)
at Object.listen (/../app/node_modules/history/lib/createBrowserHistory.js:144:28)
at Object.listen (/../app/node_modules/history/lib/useBasename.js:78:22)
at Object.listen (/../app/node_modules/history/lib/useQueries.js:111:22)
at syncHistory (/../app/node_modules/react-router-redux/lib/index.js:78:11)
@Sebmaster I confirm this fixes it:
const jsdom = require('jsdom').jsdom
global.document = jsdom('<!doctype html><html><body><div id="app"></div></body></html>', {
url: 'http://localhost'
})
global.window = document.defaultView
global.navigator = global.window.navigator
Just in case anyone was led here via the same stack trace I was:
If you're using Jest, don't forget to add a testURL property to your Jest config. This fixed the issue for me 馃憤
@marlonicus would you mind updating that to testURL
(all-caps URL)? Thanks for this.
Most helpful comment
Just in case anyone was led here via the same stack trace I was:
If you're using Jest, don't forget to add a testURL property to your Jest config. This fixed the issue for me 馃憤