github avatar

React19 Test Patterns

If you're migrating tests to React 19, this gives you the exact before/after patterns for the breaking changes. It covers the act() import move from react-dom/test-utils to react, replacing the removed Simulate API with fireEvent, and the StrictMode call count adjustments since effects no longer double-invoke in development. The priority order is smart: fix act() imports first since everything else depends on it, then work through Simulate, then tackle the call count assertions. The StrictMode section is honest about measuring actual counts instead of guessing, which will save you from chasing phantom bugs when your spies expect 2 calls but now get 1.

skills.sh installs
1.3K
GitHub stars
41K
last updated
Aug 21, 2026

Install

$ npx -y skills add github/awesome-copilot --skill react19-test-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

React 19 Test Migration Patterns

Reference for all test file migrations required by React 19.

Priority Order

Fix test files in this order; each layer depends on the previous:

  1. act import fix first, it unblocks everything else
  2. Simulate → fireEvent fix immediately after act
  3. Full react-dom/test-utils cleanup remove remaining imports
  4. StrictMode call counts measure actual, don't guess
  5. Async act wrapping for remaining "not wrapped in act" warnings
  6. Custom render helper verify once per codebase, not per test

1. act() Import Fix

// Before  REMOVED in React 19:
import { act } from 'react-dom/test-utils';

// After:
import { act } from 'react';

If mixed with other test-utils imports:

// Before:
import { act, Simulate, renderIntoDocument } from 'react-dom/test-utils';

// After  split the imports:
import { act } from 'react';
import { fireEvent, render } from '@testing-library/react'; // replaces Simulate + renderIntoDocument

2. Simulate → fireEvent

Sponsors

Details

Repository
github.com/github/awesome-copilot
Categories
Frontend Development, Testing & QA, Git & Pull Requests, AI & Agent Building
First seen
May 16, 2026

More from github/awesome-copilot

All 318
1davila7 avatarsenior-qadavila7/claude-code-templatesComprehensive QA and testing skill for quality assurance, test automation, and testing strategies for ReactJS, NextJS, NodeJS applications. Includes test suite 1.2Kskills.sh installs
2mindrally avatarbootstrapmindrally/skillsBootstrap development guidelines for responsive layouts, components, and utility-first styling.1.2Kskills.sh installs
3kostja94 avatarimage-optimizationkostja94/marketing-skillsWhen the user wants to optimize images for search engines and performance. Also use when the user mentions "image SEO," "alt text," "image captions," "figcaptio1.2Kskills.sh installs
4vtex avatarvtex-io-messages-and-i18nvtex/skillsApply when implementing localization and translated copy in VTEX IO apps. Covers the `messages` builder, `/messages/*.json`, `context.json`, frontend message us1.2Kskills.sh installs
5vtex avatarfaststore-storefrontvtex/skillsCore coding rules and workflow for developing VTEX FastStore storefronts. Use when starting any FastStore development task, writing TypeScript/React components,1.2Kskills.sh installs
6kostja94 avatarfavicon-generatorkostja94/marketing-skillsWhen the user wants to implement, optimize, or audit favicon and app icons. Also use when the user mentions "favicon," "app icon," "browser icon," "touch icon,"1.1Kskills.sh installs