Skip to content

Drop dependency on mocha-jsdom in favor of explicit solution #158

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

Merged
merged 1 commit into from
Oct 15, 2015

Conversation

gaearon
Copy link
Contributor

@gaearon gaearon commented Oct 15, 2015

Instead of doing something mysterious with mocha-jsdom we now do as suggested in facebook/react#5046 (comment).

gaearon added a commit that referenced this pull request Oct 15, 2015
Drop dependency on mocha-jsdom in favor of explicit solution
@gaearon gaearon merged commit 730710c into master Oct 15, 2015
@gaearon gaearon deleted the no-mocha-jsdom branch October 15, 2015 15:16
@zpratt
Copy link

zpratt commented Oct 18, 2015

@gaearon: I have been using a similar solution to this for my tests for quite some time. Recently we have switched to using the shallow renderer, which has allowed us to remove jsdom from our tests completely. This has given our tests a significant speed boost. Shallow rendering also forces you to keep each component relatively simple since it prevents you from testing heavily nested components.

Just thought I'd share a tip on something that we've found to be valuable.

@gaearon
Copy link
Contributor Author

gaearon commented Oct 18, 2015

We are using shallow rendering too, take a closer look :-) The only reason we use jsdom is to prevent React from blowing up with errors when using setState with shallow renderer. (facebook/react#4019) I have heard people say that actually shimming global.document = {} is enough for React to work properly. If that's really so, we can drop jsdom from instructions.

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

Successfully merging this pull request may close these issues.

2 participants