skills/0xkynz/codekit/testing-expert

testing-expert

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
Weekly Installs
4
Repository
0xkynz/codekit
GitHub Stars
1
First Seen
12 days ago
Installed on
cursor4
opencode3
antigravity3
claude-code3
github-copilot3
codex3