What problem does it solve?
Writing unit tests for React components and hooks is crucial but can be time-consuming and repetitive. This skill automates the generation of comprehensive Vitest test files, adhering to best practices and accelerating your testing workflow.
Core Features & Use Cases
- Automated Test Generation: Scaffolds Vitest unit tests for React components and hooks, including render, props, interaction, state, and accessibility tests.
- React Testing Library Best Practices: Utilizes
screen queries, userEvent for realistic interactions, and vi.fn() for mocks, ensuring high-quality, maintainable tests.
- Comprehensive Scenarios: Includes boilerplate for common test cases like disabled states, loading states, and error handling, with clear TODOs for edge cases and snapshots.
- Use Case: When developing new React components or hooks, use this skill to quickly generate a robust test suite, accelerating your development workflow and improving code quality.
Quick Start
Create Vitest unit tests for the 'Button' component located at 'src/components/ui/Button/Button.tsx'.