question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use react-testing-library

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
dferber90commented, Sep 5, 2018

Done

1reaction
dferber90commented, Sep 4, 2018

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, the maxWorkers issue seems to be the cause of the slowdown observed here.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found