New advertisers: 50% off your first month with code FIRSTMONTHSee slots
github avatar

React18 Enzyme To Rtl

Migrates Enzyme tests to React Testing Library with behavior-focused rewrites for React 18 upgrades.

skills.sh installs
743
GitHub stars
41.4K
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers the Enzyme-to-RTL API mapping for shallow, mount, find, simulate, prop, state, and instance calls
  • Includes reference files for the full API map and async patterns such as waitFor, findBy, act(), and Apollo MockedProvider
  • Enforces a query priority order, favoring getByRole over getByTestId, and asserting visible output rather than internal state
  • Designed for teams upgrading to React 18 that must rewrite Enzyme test files without a 1:1 translation

Install

$ npx -y skills add github/awesome-copilot --skill react18-enzyme-to-rtl -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

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

Details

Repository
github.com/github/awesome-copilot
Categories
Testing & QA, Frontend & UI Code
First seen
May 16, 2026

More from github/awesome-copilot

All 293

Similar to React18 Enzyme To Rtl

More Testing & QA