Migrating from Enzyme to React Testing Library
summary
Concrete claim: enzyme breaks on React 17/18 and is effectively dead, so tests need migration. Evidence: an unofficial React 17 adapter gets half a million downloads a week and an 18 adapter proves infeasible after many releases. Tools and patterns shown: enzyme's shallow/mount vs react testing library's full render and query family. Surprising numbers: adapter traffic and 24 releases. Practical changes: rewrite tests to getByRole / findBy and sometimes change source code for accessibility; async and typing become simpler and more reliable.
AI-written summary · about
chapters (10)
- 0:00Introduction and context
- 1:17The end of Enzyme
- 4:42React testing library
- 5:51Speaker background
- 8:44Component rendering
- 12:06Querying strategies
- 15:54Testing asynchronous code
- 21:19Migrating best practices
- 22:14Simulating user interactions
- 24:29Resources and conclusion
related talks
22mElizabeth Funk - An Introduction to React Testing Library
39mReact Hooks broke my tests, now what?
16mCrushing React bugs with Jest and Enzyme
24mUsing React Testing Library to Write Stronger Tests
18mTesting React in a Right Way
12mBDD & TDD in React
06mJest & Enzyme-testing your React application
30mTesting Front-End Applications
