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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from enzyme to react testing library #2754

Merged
merged 26 commits into from Jun 15, 2022

Conversation

kr8n3r
Copy link
Contributor

@kr8n3r kr8n3r commented Jun 8, 2022

What

Why

We use React 18 but Enzyme react adaptor only supports 16. This wasn't an issue until this week our builds started failing to build (see below)

Enzyme seems to be dying a slow death, as there isn't even a react 17 adapter. Meanwhile RTL fully supports React 18 and we want to be able to upgrade in the future.


while resolving: enzyme-adapter-react-16@1.15.6
npm ERR! Found: react@18.1.0
npm ERR! node_modules/react
npm ERR!   react@"^18.1.0" from the root project
npm ERR!   peer react@"^18.1.0" from react-dom@18.1.0
npm ERR!   node_modules/react-dom
npm ERR!     react-dom@"^18.1.0" from the root project
npm ERR!   1 more (react-markdown)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0-0" from enzyme-adapter-react-16@1.15.6
npm ERR! node_modules/enzyme-adapter-react-16
npm ERR!   dev enzyme-adapter-react-16@"^1.15.6" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: react@16.14.0
npm ERR! node_modules/react
npm ERR!   peer react@"^16.0.0-0" from enzyme-adapter-react-16@1.15.6
npm ERR!   node_modules/enzyme-adapter-react-16
npm ERR!     dev enzyme-adapter-react-16@"^1.15.6" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Migrating to @testing-library is the only logical option. Downgrading React isn't an option.

Addresses #2748

How to review

  • tests pass - as we have coverage enabled and rewritten tests need to cover the code as before. If all is green, then coverage is the same
  • review code by commit (easiest to see changes)

Who can review

not @kr8n3r


馃毃鈿狅笍 Please do not merge this pull request via the GitHub UI 鈿狅笍馃毃

@kr8n3r kr8n3r closed this Jun 8, 2022
@kr8n3r kr8n3r reopened this Jun 8, 2022
@kr8n3r kr8n3r force-pushed the move-from-enzyme-to-react-testing-library branch 2 times, most recently from d5f56cb to 2dfce9b Compare June 10, 2022 13:48
@kr8n3r kr8n3r force-pushed the move-from-enzyme-to-react-testing-library branch from 2dfce9b to eb16231 Compare June 10, 2022 13:54
@kr8n3r kr8n3r marked this pull request as ready for review June 10, 2022 14:10
@kr8n3r kr8n3r added the dependencies Pull requests that update a dependency file label Jun 11, 2022
Copy link
Contributor

@schmie schmie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sampled equivalence of checks, some new TS complaints, but all suites passing - LGTM 馃憤

@kr8n3r kr8n3r merged commit b6bca52 into main Jun 15, 2022
@kr8n3r kr8n3r deleted the move-from-enzyme-to-react-testing-library branch June 15, 2022 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants