react-testing

Guides React test strategy across browser, unit, and component test tiers.

1|Updated Apr 15, 2026
One-click install
npx skills add https://github.com/pnewsam/skills --skill react-testing-pnewsam
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: react-testing
Source: https://github.com/pnewsam/skills/tree/main/archive/react-pilot/react-testing
Command: npx skills add https://github.com/pnewsam/skills --skill react-testing-pnewsam

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? React teams often waste effort writing shallow component tests while leaving critical user flows untested. This Skill provides a testing philosophy that allocates effort by confidence-per-cost, so you know which tests are worth writing and which are maintenance liabilities. ## Core Features & Use Cases - Three-tier test strategy: Prioritizes real-browser integration tests (Playwright) for critical flows, unit tests (Vitest) for business logic, and minimal jsdom component tests for complex shared components. - Decision guide: A table mapping common changes (new flow, bug fix, refactor, styling) to the right test type — or no test at all. - Principles for test quality: Covers behavior-over-implementation assertions, mocking at the network boundary with MSW, handling flaky tests, CI execution, and accessibility testing placement. - Use Case: When adding a new invoice-creation feature, use this Skill to decide that a Playwright browser test covers the flow, a unit test covers the total calculation, and no component test is needed for the page-level form. ## Quick Start Ask the AI to review your React feature and recommend which tests to write using the react-testing philosophy.

Frequently Asked Questions about react-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decide what to test in a React application?▼

Prioritize by confidence-per-cost: write browser tests for critical user flows, unit tests for non-trivial business logic, and component tests only for complex shared components. Skip tests for trivial functions, styling, and refactors without behavior changes.

Should I use Playwright or React Testing Library for React tests?▼

Use Playwright for end-to-end flows in a real browser, which gives the highest confidence. Use React Testing Library with Vitest for unit tests of logic and the few component tests worth keeping, since jsdom lacks real layout and many Web APIs.

When are React component tests worth writing?▼

Component tests are worth it for complex interactive components like multi-selects or drag-and-drop, and for shared design-system components with wide blast radius. Avoid them for page-level components and presentational components, which browser tests cover better.

Why do jsdom component tests give false confidence?▼

jsdom is not a real browser: it lacks layout, real event bubbling, intersection observers, and many Web APIs, so tests can pass in jsdom but fail in production. Heavy mocking of routers and contexts also means the test verifies the mocks, not the component.

How do I fix flaky browser tests in Playwright?▼

Fix or delete flaky tests rather than skipping them. Common causes are timing issues (wait for elements instead of using sleep), shared state between tests, and animations interfering with clicks; seed data explicitly and keep tests independent.