the-road-to-learn-react / react-testing-mocha-chai-enzyme

A solid test setup for React components with Mocha, Chai, Sinon, Enzyme in a Webpack/Babel application.
https://www.robinwieruch.de
49 stars 26 forks source link

Why add JSDOM if it comes with Jest? #22

Closed kon-rad closed 5 years ago

kon-rad commented 5 years ago

Hello, Why did you set up jsdom this way as in this file: react-components-test-setup/test/dom.js Doesn't jsdom come with jest alrady when run with--env=jsdom option?

Label: Question

rwieruch commented 5 years ago

I don't know. Does it? Did you try without it? :)

kon-rad commented 5 years ago

yes I believe so. I haven't found much documentation on this from jest, but found it referenced in various s/o posts like this one https://stackoverflow.com/questions/40970780/how-to-setup-jsdom-when-working-with-jest

rwieruch commented 5 years ago

Ah okay. Then, if using Jest, I guess you don't need it. I just added it because I started with Enzyme in this tutorial https://www.robinwieruch.de/react-testing-tutorial and transitioned over to Jest. I think you need it for Enzyme though if not using it with Jest.