react-testing-conventions
Testing conventions for React Native with TypeScript. Use this skill when writing tests, reviewing test code, or setting up test infrastructure. Covers unit tests, integration tests, component tests, test doubles (dummy, stub, spy, mock), builder pattern for fixtures, and the testing pyramid.
Security Assessment
About react-testing-conventions
The `react-testing-conventions` skill provides a structured approach to testing React Native applications using TypeScript. It addresses common challenges in writing and maintaining reliable tests by defining clear conventions for test organization, naming, and execution. By following these guidelines, developers can ensure their tests are fast, maintainable, and consistent across the codebase, reducing flakiness and improving overall code quality. This skill is especially helpful for teams adopting Test-Driven Development (TDD) or integrating new developers into a project with established testing standards.
Key features of this skill include guidance on the testing pyramid, emphasizing a hierarchy of unit, integration, and end-to-end tests, as well as adherence to the FIRST principles to ensure tests are fast, independent, repeatable, self-validating, and timely. It defines file naming conventions for unit and E2E tests, recommends colocating unit and integration tests with the code they test, and provides a dedicated structure for E2E tests. Additionally, it covers the AAA (Arrange, Act, Assert) pattern for writing tests, test naming best practices, and the principle of having one logical assertion per test. The skill also explains the use of test doubles such as dummies, stubs, spies, and mocks, and suggests using the builder pattern for test fixtures to streamline test setup.
This skill is ideal for software engineers, QA engineers, and code reviewers working with React Native and TypeScript who want to standardize testing practices within their projects. It can be applied when writing new tests, reviewing existing test code, or setting up test infrastructure to ensure consistent quality and maintainability. By following the conventions outlined, teams can reduce errors, accelerate development cycles, and foster a culture of reliable, well-tested code.
FAQ
Which testing frameworks does this skill support?
This skill is designed for use with Jest and the React Native Testing Library in TypeScript projects.
Can I use these conventions for end-to-end tests?
Yes, the skill provides guidance for E2E tests using Maestro, including dedicated folder structures and naming conventions.
Are these conventions mandatory for all React Native projects?
No, they are guidelines aimed at improving consistency and reliability, but teams can adapt them based on project needs.
Do these guidelines support Test-Driven Development (TDD)?
Yes, the FIRST principles and timely test writing are aligned with TDD practices, encouraging writing tests alongside or before code.
What types of test doubles are covered?
The skill covers dummy objects, stubs, spies, and mocks for use in unit and integration testing scenarios.
Install react-testing-conventions
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
benaor/claude-config