douglasduteil / isparta

:skull: A code coverage tool for ES6 (babel/6to5)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Virtual DOM (jsdom) not available globally before requiring React

desytech opened this issue · comments

commented

Setup

  • isparta 4.0.0
  • mocha 3.2.0
  • babel-cli 6.18.0
  • enzyme 2.6.0
  • jsdom 9.9.1

Using enyzme's full lifecycle rendering https://github.com/airbnb/enzyme/blob/master/docs/api/mount.md and it seem that jsdom have to be initialized globally before isparta includes all sources!

CLI call
babel-node node_modules/isparta/bin/isparta cover --report html --include-all-sources --root 'src/js/' --include '**/*.js' _mocha -- --require ./test/setup.js --recursive ./test

Issue
with --include-all-sources i get following error

Invariant Violation: dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a worker thread. Make sure windowanddocument are available globally before requiring React when unit testing or use ReactDOMServer.renderToString() for server rendering.

without iam getting no error, but also an uncompleted coverage report

Q
is there any way to initialize jsdom before isparta includes the sources?