typescript-testing
Standardizes Vitest unit and integration testing workflows for TypeScript, enforcing 70% coverage, proper mocking, and CI/CD-ready verification patterns.
Introduction
This skill provides a structured testing framework for TypeScript projects using Vitest, designed for developers who need to maintain high software quality and robust CI/CD pipelines. It moves beyond basic testing by enforcing rigorous quality standards, such as a mandatory 70% unit test coverage, environment-independent test execution, and strict architectural decoupling. The agent ensures that test code is held to the same readability and maintainability standards as production code, utilizing specialized conventions for directory structures, naming, and assertion types.
-
Enforces unit testing with comprehensive mocking strategies using vi.mock() while providing clear guidance on when to prefer real database implementations over mocks for data layer testing.
-
Integrates complex testing patterns including integration testing for component coordination and E2E cross-functional verification to ensure system stability during feature addition.
-
Supports advanced verification techniques such as property-based testing with fast-check to validate invariants and boundary error cases.
-
Promotes automatic test execution via command-line interface tools, including process cleanup scripts for Vitest to prevent zombie process leakage in CI/CD environments.
-
Provides clear rules on avoiding anti-patterns like test.skip() or commented-out code, favoring direct deletion or full remediation to ensure test suite completeness.
-
Input: Target TypeScript service or feature module. The agent expects clear business requirements and integration points defined in project Design Docs.
-
Output: High-quality, maintainable test files (.test.ts or .int.test.ts) that adhere to project-specific coverage thresholds and type-safe mocking conventions.
-
Constraints: Strictly requires 70% coverage across statements, branches, functions, and lines. Mocks must be limited to external I/O and direct dependencies; database logic requires actual database verification (containerized or in-memory) to prevent schema drift and query errors.
-
Best practices: Always prioritize result-based verification over invocation order, use literal values for assertions to decouple test intent from implementation, and ensure all tests are reproducible and independent.
Repository Stats
- Stars
- 204
- Forks
- 20
- Open Issues
- 0
- Language
- JavaScript
- Default Branch
- main
- Sync Status
- Idle
- Last Synced
- May 1, 2026, 08:07 AM