-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
We currently use enzyme
for a lot of our tests. However, it is not keeping pace with the developments in the React and encourages poor testing practices.
We should be focusing on making tests resemble the way Gutenberg is used by users. Unfortunately, Enzyme's APIs encourage/enable "poor" testing practices such as testing component implementation details and shallow rendering which doesn't provide confidence that your "feature" works when all the components are wired together.
Describe the solution you'd like
-
An official announcement formally moving away from Enzyme to either
- React Testing Utils
- A lightweight wrapper lib (such as React Testing Library) - note that React now officially recommends RTL as the best testing solution.
-
Updating documentation to
- advise against using Enzyme (note we currently advise that you can use it) and to prefer the new solution as above.
- include advice about good testing practices, including removing advice to use
shallow()
which is a library-specific API which enables poor testing practices
-
Incrementally converting all the existing Enzyme based tests over to the new testing solution - this does not have to be done in a single hit and we could document the key tests to target for migration and leave the others to be migrated "as and when".