badeball / karma-jsdom-launcher

A Karma plugin. Launcher for jsdom.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSDOM 10.0.0 Breaks Karma-jsdom-launcher

DaveMBush opened this issue · comments

Upgrading jsdom to 10.0.0 (released this morning) breaks karma-jsdom-launcher with "env is not a function"

The exact error is

 TypeError: jsdom.env is not a function
    at jsdomBrowser._start (.../node_modules/karma-jsdom-launcher/index.js:9:11)

In 10.0.0 the way to import jsdom is:

const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const dom = new JSDOM(``, {
  url: "https://example.org/",
  referrer: "https://example.com/",
  contentType: "text/html",
  userAgent: "Mellblomenator/9000",
  includeNodeLocations: true
});

Thanks for the heads up! I've released a version with support for jsdom-10.0.0.