Use react-testing-library
See original GitHub issueI would like to try out react-testing-library
instead of using enzyme
. In my experience it leads to more test coverage and more confidence while writing less code. The tests are also decoupled from the implementation that way.
If this is successful, I’d like to move all tests to react-testing-library
and get rid of enzyme
completely.
Additionally, our current tests are extremely slow in CI, some taking almost a minute.
PASS test src/components/buttons/link-button/link-button.spec.js (52.084s)
PASS test src/components/typography/text/text.spec.js (52.227s)
PASS test src/components/inputs/number-input/number-input.spec.js (45.348s)
PASS test src/components/switches/toggle/toggle-switch.spec.js (51.875s)
PASS test src/utils/localized.spec.js (51.361s)
PASS test src/components/buttons/ghost-button/ghost-button.spec.js (54.128s)
PASS test src/components/buttons/accessible-button/accessible-button.spec.js (52.417s)
Source: https://travis-ci.org/commercetools/ui-kit/builds/424350666.
This might improve with react-testing-library
as well.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
React Testing Library
The React Testing Library is a very light-weight solution for testing React components. It provides light utility functions on top of react-dom ...
Read more >React Testing Library Tutorial - Robin Wieruch
React Testing Library is used to interact with your React components like a human being. What a human being sees is just rendered...
Read more >React Testing Library – Tutorial with JavaScript Code Examples
React Testing Library is a testing utility tool that's built to test the actual DOM tree rendered by React on the browser. The...
Read more >How To Test a React App with Jest and React Testing Library
React Testing Library provides the screen object as a convenient way to access the pertinent queries needed to assert against the test DOM ......
Read more >Testing Overview - React
React Testing Library is a set of helpers that let you test React components without relying on their implementation details.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Done ✅
Sure! I debugged the slowdown-over-time before and found that there is a memory leak somewhere in our setup, but I couldn’t get to the bottom of it. That’s why I have some hopes, that we could avoid the memory leak in case we get rid of
enzyme
and the related components. Now that you mention it though, themaxWorkers
issue seems to be the cause of the slowdown observed here.