-
Notifications
You must be signed in to change notification settings - Fork 22
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
React TestUtils vs. enzyme #19
Comments
@nelsonic I think it really depends on how detailed you want to make the tests and if you want to test . Set up wise, there is some configuration needed for compatibility with different test runners and Enzyme still requires jsdom for full DOM rendering (the Enzyme has lots of useful methods that makes some things easier like DOM traversal, and the tests are much more readable ( There are also methods for testing interaction with React component and its lifecycle methods for example if you want to test how component behaviour changes as props change you can use the Enzyme also allows selectors for some methods to be props (As well as components, display name, classes and tags which are already available in TestUtils) which is cool but not sure how many test cases it would be used for. So in my opinion Enzyme looks cool (and I kind of want to use!) it but it might not be necessary for simple front end tests for which we could just use TestUtils and jsdom. |
@nelsonic. I think testing react with only react-test-utils is v. painful / has not really worked for me. I think that jsx code for a react component is much more readable than the tests written for those components, which makes me sad. I would be super keen to give enzyme a go (but not sure if another component test refactor should really be squeezed in anytime soon for our proj). |
@des-des @jrans @nelsonic what do you think of Teaspoon? https://github.com/jquense/teaspoon |
@des-des makes sense that you don't want to refactor your client project. 😉
@nikhilaravi has already given enzyme a go and teaspoon looks decent too.
But always open to suggestions. |
I would just like to point out that while enzyme is highly recommended it seems to have a fatal flaw: No event propagation. |
@timrichd thanks! can you point us to a link where this is documented? (please) |
@nelsonic http://airbnb.io/enzyme/docs/future.html
|
https://medium.com/airbnb-engineering/enzyme-javascript-testing-utilities-for-react-a417e5e5090f
cc: @nikhilaravi @jrans @rjmk
The text was updated successfully, but these errors were encountered: