Skip to content
This repository was archived by the owner on Dec 31, 2019. It is now read-only.
This repository was archived by the owner on Dec 31, 2019. It is now read-only.

Virtual DOM (jsdom) not available globally before requiring React #129

@desytech

Description

@desytech

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions