
React18 Enzyme To Rtl
If you're stuck migrating Enzyme tests to React Testing Library for a React 18 upgrade, this walks you through the entire API mapping and the bigger conceptual shift from implementation testing to behavior testing. It's not about translating wrapper.find() or wrapper.state() one to one, it's about rewriting tests to assert what users actually see instead of poking at component internals. You get concrete before and after examples for shallow, mount, simulate, and all the tricky async patterns with Apollo and loading states. The query priority guide alone will save you from littering tests with data-testid attributes. Covers the philosophy enough that you won't just produce brittle RTL code that still thinks like Enzyme.
- skills.sh installs
- 742
- GitHub stars
- 41K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add github/awesome-copilot --skill react18-enzyme-to-rtl --agent claude-codeInstalls into .claude/skills of the current project.
Files
React 18 Enzyme → RTL Migration
Enzyme has no React 18 adapter and no React 18 support path. All Enzyme tests must be rewritten using React Testing Library.
The Philosophy Shift (Read This First)
Enzyme tests implementation. RTL tests behavior.
// Enzyme: tests that the component has the right internal state
expect(wrapper.state('count')).toBe(3);
expect(wrapper.instance().handleClick).toBeDefined();
expect(wrapper.find('Button').prop('disabled')).toBe(true);
// RTL: tests what the user actually sees and can do
expect(screen.getByText('Count: 3')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /submit/i })).toBeDisabled();
This is not a 1:1 translation. Enzyme tests that verify internal state or instance methods don't have RTL equivalents - because RTL intentionally doesn't expose internals. Rewrite the test to assert the visible outcome instead.
API Map
Sponsors
Details
- Repository
- github.com/github/awesome-copilot
- Categories
- Frontend Development, Backend & APIs, Testing & QA, Git & Pull Requests, AI & Agent Building
- First seen
- May 16, 2026
More from github/awesome-copilot
All 318- Code Tour739
- Linkedin Post Formatter361
- Ui Screenshots212
- Data Breach Blast Radius110
- Sql Server Table Reconciliation104
- Aws Cloudwatch Investigation
- Aws Cost Optimize
- Aws Resource Health Diagnose
- Aws Well Architected Review
- Azure Well Architected Review
- Bug Reproduction Brief
- Incident Postmortem
- Mcp Implementation Security Review
- Pester Migration
- Tm7 Threat Model
- Git Commit48.4K
- Excalidraw Diagram Generator34.4K
- Multi Stage Dockerfile31.5K
- Documentation Writer28.4K
- Prd24.4K
- Refactor22.6K
- Java Springboot21.8K
- Gh Cli21.2K
- Create Readme19.5K