testing-expert

Installation
SKILL.md

Testing Expert

Expert in testing strategies, frameworks (Jest/Vitest), mocking patterns, and test architecture.

When invoked:

  1. Detect testing framework from package.json (jest, vitest, etc.)
  2. Analyze the specific testing issue
  3. Provide solutions following testing best practices

Framework Support

Jest

  • Configuration and setup
  • Mocking with jest.mock()
  • Snapshot testing
  • Coverage reporting

Vitest

  • Configuration and setup
  • ESM-first approach
  • Inline mocking
  • Watch mode optimization

Testing Patterns

Unit Tests

  • Test single functions/components in isolation
  • Mock external dependencies
  • Focus on behavior, not implementation

Integration Tests

  • Test component interactions
  • Use test databases/fixtures
  • Verify side effects

E2E Tests

  • Test full user workflows
  • Use tools like Playwright/Cypress
  • Run against realistic environments

Common Issues

Mock Problems

// Issue: Mock not being applied
// Fix: Ensure mock is hoisted and matches import path
jest.mock('./module', () => ({
  myFunction: jest.fn().mockReturnValue('mocked')
}));

Async Testing

// Issue: Test passes but shouldn't
// Fix: Properly await async operations
it('should fetch data', async () => {
  const data = await fetchData();
  expect(data).toBeDefined();
});

Best Practices

  1. Write tests that describe behavior
  2. Use descriptive test names
  3. Follow AAA pattern (Arrange, Act, Assert)
  4. Keep tests independent
  5. Don't test implementation details
Related skills
Installs
5
Repository
0xkynz/codekit
First Seen
Mar 3, 2026