jsdom-global icon indicating copy to clipboard operation
jsdom-global copied to clipboard

Invalid URL error

Open linnett opened this issue 8 years ago • 1 comments

I'm getting the following error when importing into ES6 tests like this import 'jsdom-global/register'.

<project-root>/node_modules/whatwg-url/lib/URL-impl.js:19
      throw new TypeError("Invalid URL");

TypeError: Invalid URL

Do you know why this could be?! Thanks

linnett avatar Sep 02 '16 09:09 linnett

The issue most likely comes from the fact the window location is not properly initiated. about:blank cannot be parsed as an URL.

I fixed a similar issue by doing something like

window.location = {
  href: 'http://localhost'
}

balthazar avatar Nov 12 '16 01:11 balthazar