Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
github avatar

React19 Test Patterns

  • 979 installs
  • 37.1k repo stars
  • Updated July 28, 2026
  • github/awesome-copilot

react19-test-patterns provides React 19 test migration before/after patterns.

About

The react19-test-patterns skill provides before-and-after patterns for migrating test files to React 19 compatibility. It covers act import changes, removal of react-dom/test-utils Simulate helpers, and StrictMode double-render call count adjustments in assertions. Agents apply reference diffs when upgrading React versions in libraries or apps with large test suites. The skill prevents flaky or falsely failing tests during React 19 adoption by documenting expected behavior shifts explicitly. React 19 test migration before/after reference patterns. act import updates and Simulate removal guidance. StrictMode call count changes in test assertions. Library and app test suite upgrade workflows. Prevents false failures during React 19 adoption. Migrate tests to React 19: act imports, Simulate removal, StrictMode call count changes.

  • React 19 test migration before/after reference patterns.
  • act import updates and Simulate removal guidance.
  • StrictMode call count changes in test assertions.
  • Library and app test suite upgrade workflows.
  • Prevents false failures during React 19 adoption.

React19 Test Patterns by the numbers

  • 979 all-time installs (skills.sh)
  • +29 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #372 of 2,277 Frontend Development skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
From the docs

What react19-test-patterns says it does

Provides before/after patterns for migrating test files to React 19 compatibility
SKILL.md
npx skills add https://github.com/github/awesome-copilot --skill react19-test-patterns

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs979
repo stars37.1k
Security audit3 / 3 scanners passed
Last updatedJuly 28, 2026
Repositorygithub/awesome-copilot

How do I fix React 19 test failures for act and StrictMode?

Migrate tests to React 19: act imports, Simulate removal, StrictMode call count changes.

Who is it for?

Teams upgrading React 19 with failing or flaky unit tests.

Skip if: Skip for apps not upgrading to React 19 yet.

When should I use this skill?

User migrates React tests to v19, fixes act imports, or StrictMode counts.

What you get

Updated tests with React 19 compatible act imports and assertion counts.

  • Migrated React 19 test files
  • Updated act and fireEvent import patterns

By the numbers

  • Covers 5 ordered test migration layers for React 19 compatibility

Files

SKILL.mdMarkdownGitHub ↗

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

// Before  Simulate REMOVED in React 19:
import { Simulate } from 'react-dom/test-utils';
Simulate.click(element);
Simulate.change(input, { target: { value: 'hello' } });
Simulate.submit(form);
Simulate.keyDown(element, { key: 'Enter', keyCode: 13 });

// After:
import { fireEvent } from '@testing-library/react';
fireEvent.click(element);
fireEvent.change(input, { target: { value: 'hello' } });
fireEvent.submit(form);
fireEvent.keyDown(element, { key: 'Enter', keyCode: 13 });

---

3. react-dom/test-utils Full API Map

Old (react-dom/test-utils)New location
actimport { act } from 'react'
SimulatefireEvent from @testing-library/react
renderIntoDocumentrender from @testing-library/react
findRenderedDOMComponentWithTaggetByRole, getByTestId from RTL
findRenderedDOMComponentWithClassgetByRole or container.querySelector
scryRenderedDOMComponentsWithTaggetAllByRole from RTL
isElement, isCompositeComponentRemove not needed with RTL
isDOMComponentRemove

---

4. StrictMode Call Count Fixes

React 19 StrictMode no longer double-invokes useEffect in development. Spy assertions counting effect calls must be updated.

Strategy always measure, never guess:

# Run the failing test, read the actual count from the error:
npm test -- --watchAll=false --testPathPattern="[filename]" --forceExit 2>&1 | grep -E "Expected|Received"
// Before (React 18 StrictMode  effects ran twice):
expect(mockFn).toHaveBeenCalledTimes(2);  // 1 call × 2 (strict double-invoke)

// After (React 19 StrictMode  effects run once):
expect(mockFn).toHaveBeenCalledTimes(1);
// Render-phase calls (component body)  still double-invoked in React 19 StrictMode:
expect(renderSpy).toHaveBeenCalledTimes(2);  // stays at 2 for render body calls

Related skills

How it compares

Use react19-test-patterns over generic React upgrade docs when failures are specifically in test files around act, Simulate, test-utils, or StrictMode counts.

FAQ

What breaking test changes?

act imports, Simulate removal, and StrictMode call count shifts.

What format?

Before/after migration patterns for test files.

When is it needed?

During React 19 upgrades with failing or outdated test utilities.

Is React19 Test Patterns safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.