rstacruz/jsdom-global

Invalid URL error

Opened this issue · 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

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'
}