
React Testing
A strong foundation for testing React components the modern way: React Testing Library, Vitest or Jest, MSW for HTTP mocking, and axe for accessibility checks. The guide is opinionated in the right ways, prioritizing user-facing behavior over implementation details, accessible queries over test IDs, and userEvent over fireEvent. The MSW setup with onUnhandledRequest error is excellent for catching silent test passes. The custom hook testing section correctly warns about QueryClient instantiation gotchas. Light on the boundary between component tests and full E2E, but the query priority table and provider wrapping pattern alone will save you from common mistakes if you're migrating from Enzyme or setting up tests from scratch.
- skills.sh installs
- 5.8K
- GitHub stars
- 300.3K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add affaan-m/ecc --skill react-testing --agent claude-codeInstalls into .claude/skills of the current project.
Files
React Testing
Comprehensive React testing patterns for behavior-focused component tests, custom hook tests, accessibility assertions, and network-level mocking.
When to Activate
- 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
Core Principle
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
Library Choice
Sponsors
Details
- Repository
- github.com/affaan-m/ecc
- Categories
- Frontend Development, Testing & QA, Documentation, Productivity & Planning, Design & UI/UX
- First seen
- Jul 14, 2026
More from affaan-m/ecc
All 263- Pytorch Patterns5.8K
- Hexagonal Architecture5.8K
- Flutter Dart Code Review5.8K
- Frontend A11y5.8K
- Error Handling5.8K
- Ui Demo5.8K
- Agentic Engineering5.8K
- Vite Patterns5.8K
- Bun Runtime5.8K
- Agent Architecture Audit5.8K
- Nodejs Keccak2565.8K
- Security Scan5.8K
- Cpp Testing5.8K
- Django Tdd5.8K
- Dashboard Builder5.7K
- Redis Patterns5.7K
- Eval Harness5.7K
- Manim Video5.7K
- Content Engine5.7K
- Springboot Tdd5.7K
- Motion Patterns5.7K
- Configure Ecc5.7K
- Token Budget Advisor5.7K
- Investor Materials5.7K