Migrate to React Testing Library
Context
Enzyme is dead. (There will be no React 18 support)
It prevent us from migrating our app to further version of React by breaking our tests.
RTL
RTL is now the default choice when testing applications. It is progressively sowing more results in stack overflow exchanges making solutions harder to find on specific issues.
From the blog post https://testing-library.com/docs/react-testing-library/migrate-from-enzyme/
React Testing Library is part of an open-source project named Testing Library. There are several other helpful tools and libraries in the Testing Library project which you can use to write more concise and useful tests. Besides React Testing Library, here are some of the project's other libraries that can help you along the way:
Why should I use React Testing Library?
The primary purpose of React Testing Library is to increase confidence in your tests by testing your components in the way a user would use them. Users don't care what happens behind the scenes, they just see and interact with the output. Instead of accessing the components' internal APIs or evaluating their state, you'll get more confidence by writing your tests based on the component output.
React Testing Library aims to solve the problem that many developers face when writing tests with Enzyme, which allows (and encourages) developers to test implementation details. Tests which do this ultimately prevent you from modifying and refactoring the component without changing its tests. As a result, the tests slow down development speed and productivity. Every small change may require rewriting some part of your tests, even if the change does not affect the component's output.
Rewriting your tests in React Testing library is worthwhile because you'll be trading tests that slow you down for tests that give you more confidence and increase your productivity in the long run.
Ressources
https://testing-library.com/docs/
https://testing-library.com/docs/guiding-principles/
Tasks
Update 135 test suites over 29 folders.
MR should respect the format test(rtl): FOLDER_NAME