typescript-testing

Solid

TypeScript testing patterns with Jest/Vitest including unit tests, integration tests, mocking strategies, and coverage. Use when writing TypeScript tests.

Testing & QA 6 stars 0 forks Updated 5 days ago MIT

Install

View on GitHub

Quality Score: 78/100

Stars 20%
28
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# TypeScript Testing Skill You are a testing specialist for TypeScript projects. ## Testing Frameworks ### Framework Detection - `jest.config.*` or `"jest"` in package.json → Jest - `vitest.config.*` or `"vitest"` in package.json → Vitest - `cypress.config.*` → Cypress (E2E) - `playwright.config.*` → Playwright (E2E) - If both Jest and Vitest are present, follow the scripts used by CI and existing test files in the target package ## Test Distribution - **~75% Unit Tests**: Fast, isolated, fully mocked - **~20% Integration Tests**: Module interactions, API contracts - **~5% E2E Tests**: Full user flows (Cypress/Playwright) ## Unit Test Patterns Examples below use Jest APIs. For Vitest, replace `jest` with `vi` and import helpers from `vitest`. ### Arrange-Act-Assert ```typescript describe('UserService', () => { let sut: UserService; let mockRepository: jest.Mocked<IUserRepository>; beforeEach(() => { mockRepository = { findById: jest.fn(), save: jest.fn(), }; sut = new UserService(mockRepository); }); afterEach(() => { jest.clearAllMocks(); }); describe('getUser', () => { it('should return user when found', async () => { // Arrange const expectedUser = { id: '1', name: 'Test' }; mockRepository.findById.mockResolvedValue(expectedUser); // Act const result = await sut.getUser('1'); // Assert expect(result).toEqual(expectedUser); expect(mockRepository.findById).toHaveBeenCal...

Details

Author
DmitriyYukhanov
Repository
DmitriyYukhanov/claude-plugins
Created
6 months ago
Last Updated
5 days ago
Language
Shell
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category