SKILL

react-testing

React component testing with React Testing Library, Vitest/Jest, MSW for network mocking, accessibility assertions with axe, and the decision boundary between component tests and Playwright/Cypress end-to-end runs. Use when writing or fixing tests for React components, hooks, or pages.

Target: React / Next.js. Automatically collected · unverified.

Excerpt from the author’s documentation

Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.

Read the original English text

Topics in the source

  • React Testing
  • When to Activate
  • Core Principle
  • Library Choice
  • Query Priority
  • User Interaction with userEvent
  • Async Patterns
  • Network Mocking with MSW

Comprehensive React testing patterns for behavior-focused component tests, custom hook tests, accessibility assertions, and network-level mocking. Writing tests for React components, custom hooks, or pages Adding test coverage to legacy untested components Migrating from Enzyme or class-component-era patterns to React Testing Library Setting up Vitest or Jest for a new React project Mocking HTTP requests in tests Asserting accessibility violations Deciding which tests belong in RTL vs Playwright Component Testing vs full E2E Test what the user sees and does, not implementation details. A test should: Render the component with the same providers it has in production Interact with it via accessible queries (role, label) and userEvent Assert visible output and observable side effects (callback fired, request sent) A test should NOT: Inspect component state, props passed to children, or which hooks were called Mock React itself or framework hooks Assert on the number of renders or DOM structure beyond what affects users | Runner | When | Note | |---|---|---| | Vitest | Vite, Remix, modern setups | Faster, native ESM, Jest-compatible API | | Jest | Next.js, CRA, established repos | Defa

This is an excerpt. Refer to the complete source and its current requirements.

Source repository
affaan-m/ECC
Source file
pi/core/skills/react-testing/SKILL.md
Fixed revision
d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
Read the complete original documentation ↗

Sources and evidence

This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.

Author: affaan-m/ECC · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-09T15:01:43.244Z.

Categories are inferred from names, descriptions and paths. They do not establish compatibility.

License and attribution

MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.

Original license ↗

Synchronization, copying and user-reported success do not mark a resource as runtime-tested.

Limitations and notes

  • Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.