-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Drop and remove enzyme in favour of React Testing Utils or lightweight wrapper lib #17249
Copy link
Copy link
Closed
Labels
[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Tool] WP Scripts/packages/scripts/packages/scripts[Type] Automated TestingTesting infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Metadata
Metadata
Labels
[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Tool] WP Scripts/packages/scripts/packages/scripts[Type] Automated TestingTesting infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Type
Fields
Give feedbackNo fields configured for issues without a type.
We currently use
enzymefor 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
Updating documentation to
shallow()which is a library-specific API which enables poor testing practicesIncrementally 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".