Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup with jsdom and chai-enzyme #158

Open
NicolasSiver opened this issue Mar 22, 2017 · 2 comments
Open

Setup with jsdom and chai-enzyme #158

NicolasSiver opened this issue Mar 22, 2017 · 2 comments

Comments

@NicolasSiver
Copy link

Hello.

I'm trying to add chai-enzyme. When I add import ChaiEnzyme from 'chai-enzyme' several tests are failing with an error:

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

I was able to fix it, by making sure that chai-enzyme imported and initiated after jsdom.

@mocheng
Copy link

mocheng commented Mar 23, 2017

I met same issue.

Hard for me to figure this out, since I have already cha-enzyme in my unittesting initialization code. With chai-enzyme imported before jsdom, React component cannot render different type of root element in re-render with the dangerouslyReplaceNodeWithMarkup error message.

@shepmaster
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants