Write unit tests, component tests, and integration tests for AiderDesk using Vitest and React Testing Library. Use when creating new tests, adding test coverage, configuring mocks, setting up test files, or debugging failing tests.
100
Does it follow best practices?
Agent success when using this skill
Validation for skill structure
Write effective tests using Vitest and React Testing Library.
Create a unit test in src/common/__tests__/utils/math.test.ts:
import { describe, it, expect } from 'vitest';
import { add } from '../../utils/math';
describe('math utility', () => {
it('adds two numbers correctly', () => {
expect(add(1, 2)).toBe(3);
});
});Run tests with npm run test.
Focus on pure functions and logic in src/main or src/common. Use vi.mock() for dependencies.
Test React components in src/renderer. Focus on user interactions and props.
Use centralized mock factories for consistent testing across components and contexts.
vi.mock() paths and return values match expectationsscreen.debug()npm run test:node -- --no-color -t "test name"npm run test:coverage to confirm new code is testedFor detailed information:
9d1b1c7
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.