About react-testing
react-testing is a skill for developers writing React tests centered on user behavior. It covers test setup, interactions, async UI, integration, and accessibility, with guidance for common testing pitfalls.
Key features
- 01Vitest and Jest setup
- 02Accessibility-oriented queries
- 03userEvent interaction tests
- 04Async UI and hook testing
- 05Provider-aware render utilities
- 06Media and browser API mocks
Use cases
- 01Set up a React test runner
- 02Verify forms and interaction flows
- 03Test async UI and context-wrapped components
- 04Check accessibility states and mock media behavior
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ josiahsiegel/ claude-plugin-marketplace --skill react-testingAfter installing, type/react-testingin Claude Code to confirm it loaded.
Bundled filesreferences/react-testing-complete-guide.mdreferences/testing-recipes.md
Details
From the project READMEReact Testing Skill
Use this skill for React tests that focus on user behavior: Vitest/Jest setup, Testing Library queries, user-event flows, async UI, hooks, providers, mocks, integration tests, accessibility checks, and media component tests.
When to Use This Skill
Use when the user asks for tasks covered by the frontmatter triggers, especially implementation guidance, debugging, architecture choices, production hardening, or performance-sensitive decisions in this domain. Start from this orchestrator, then load the focused reference file that matches the requested detail level.
Core Workflow
- Set up the runner and jsdom environment first, then centralize
@testing-library/jest-dom, cleanup, and browser API mocks in test setup. - Write tests from the user perspective using role, label, text, placeholder, and display-value queries before falling back to test IDs.
- Use
userEvent.setup()for interactions andwaitForor findBy queries for async state changes. - Mock at module or network boundaries, not internal component state, and reset mocks between tests.
- Create provider-aware render utilities for context, routers, query clients, themes, and other app-wide wrappers.
- For media components, mock jsdom gaps such as
HTMLMediaElement.play,pause,load, metadata properties, and IntersectionObserver.
Key Gotchas
- Avoid asserting implementation details such as component state; assert visible behavior and accessibility state.
fireEventis lower-level thanuserEvent; preferuserEventunless directly firing browser/media events is necessary.- Async assertions should wait for UI changes, not arbitrary timers.
- jsdom does not implement real media playback, layout, or browser codecs; mock those APIs deliberately.
- Provider state can leak between tests unless render utilities create fresh clients and cleanup runs after each test.
Reference Map
- references/react-testing-complete-guide.md - Full original guide covering setup, component tests, forms, async components, hooks, context, mocks, integration tests, accessibility tests, testing utilities, and video/media testing.
- references/testing-recipes.md - Additional testing recipes already maintained for this skill.
Response Guidance
- Preserve the user's existing framework, library, and tooling choices unless there is a clear compatibility or performance reason to suggest an alternative.
- Give copy-pasteable code only for the exact task at hand; otherwise point to the relevant reference section.
- Call out tradeoffs, failure modes, and verification steps for production workflows.
- Prefer accessible, maintainable, measurable solutions over clever micro-optimizations.