SYSTEM Cited by 1 source
Enzyme (React testing utility)¶
What it is¶
Enzyme is a JavaScript testing utility for React originally
developed by Airbnb. It exposes a jQuery-like API for traversing
React component trees — wrapper.find('selector'),
.instance(), .props(), .state() — and supports both full
mount(...) (actually rendered in a DOM) and shallow(...) (one
level deep, children not rendered) render modes.
Why it's fading¶
Enzyme's model inspects the React component tree (component instance, props, state) rather than the rendered DOM. This approach couples tests to React internals; each major React release required an adapter, and when React 18 shipped in 2022 no official or community Enzyme adapter materialised. The React 17 adapter's author published "Enzyme is dead. Now what?" in 2022, recommending teams look for alternatives (Source: sources/2024-06-19-slack-ai-powered-conversion-from-enzyme-to-react-testing-library).
The canonical successor is systems/react-testing-library, which tests against the rendered DOM instead of the component tree — a philosophical shift well-suited to React 18's concurrent-rendering model.
Seen in¶
- sources/2024-06-19-slack-ai-powered-conversion-from-enzyme-to-react-testing-library
— Slack migrating 15,000+ Enzyme tests to RTL as part of the
React 18 upgrade. Top-10 Enzyme methods in Slack's codebase:
find(13,244),prop(3,050),simulate(2,755),text(2,181),update(2,147),instance(1,549),props(1,522),hostNodes(1,477),exists(1,174),first(684) — plus 55 more methods (65 total). The long-tail distribution is what made pure-AST conversion infeasible.
Related¶
- systems/react-testing-library — the canonical RTL successor
- systems/enzyme-to-rtl-codemod — Slack's AI-powered migration tool
- systems/jest — the test runner Enzyme tests typically use