typescript-testing
Installation
SKILL.md
TypeScript Testing
Guidance for writing effective tests in TypeScript projects using Vitest or Jest.
Rules
- Arrange-Act-Assert: Structure tests with clear setup, execution, and verification phases
- Single Assertion Focus: Each test should verify one specific behavior
- Descriptive Names: Use
describeblocks for grouping andit/testwith clear descriptions - Test Isolation: Tests must not depend on execution order or shared mutable state
- Mock External Dependencies: Always mock I/O, network calls, and system interactions
- Coverage Targets: Aim for 80%+ line coverage, 70%+ branch coverage
- No Logic in Tests: Avoid conditionals and loops in test code
- Clean Up: Use
beforeEach/afterEachfor setup/teardown, never leave test artifacts