Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-examine unit test tooling and patterns #654

Open
joshuarrrr opened this issue Mar 31, 2023 · 2 comments
Open

Re-examine unit test tooling and patterns #654

joshuarrrr opened this issue Mar 31, 2023 · 2 comments

Comments

@joshuarrrr
Copy link
Member

For example, do we want to continue forward with enzyme, or is it worth the effort to add react-testing-library?

@SergeyMyssak
Copy link
Collaborator

Hello @joshuarrrr, I think that's a good idea. The answers to why we need this and how we can migrate tests are pretty well described in the official react-testing-library documentation. In addition, it will also help us migrate to React v18. I think we need to follow the next plan to make the migration smoother:

  • Update jest and enzyme
  • Determine what functionality is not covered and what needs to be covered first
  • Setup react-testing-library
  • Cover new or uncovered functionality with tests using react-testing-library
  • Rewrite existing tests written with enzyme using react-testing-library

@ashwin-pc
Copy link
Member

ashwin-pc commented Apr 4, 2023

+1 I think its necessary mainly because enzyme is dead (Ref) If we want to move to Node 18, this is a necessary upgrade. Some of the initial investigation we need to do here is how many tests are we talking about? Based on the last CI run i see 3067 tests and 301 test suites. There are also 254 references of enzyme in the codebase.

My initial suggestion is the following steps:

  • Audit the common enzyme patterns used in the repo
  • Break the migration down into multiple chunks so that the PR's are manageable and the change can be validated.
  • Start migration

Since react 18 forced the hands of many libraries to do a similar migration, there are plenty of articles out there explaining each of their approaches. e.g. https://blog.sentry.io/2023/02/23/sentrys-frontend-tests-migrating-from-enzyme-to-react-testing-library/

This will likely be a multistep migration, so we need to break it down into manageable subtasks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

3 participants