erichowens avatar

Vitest Testing Patterns

You're writing tests with Vitest and React Testing Library, and this gives you the patterns to do it right. It covers the practical stuff: mocking API routes and database calls, testing React components with user interactions, handling chained mocks for Drizzle ORM, and organizing test files in a Next.js project. The examples show real scenarios like authentication checks, error states, and timer mocking. It's opinionated about file structure and pairs well with E2E testing skills since unit tests are just one layer. If you're already using Vitest but keep googling how to mock that one thing, this consolidates those patterns in one place.

skills.sh installs
252
GitHub stars
113
last updated
Jun 3, 2026

Install

$ npx -y skills add erichowens/some_claude_skills --skill vitest-testing-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

Vitest Testing Patterns

This skill helps you write effective tests using Vitest and React Testing Library following project conventions.

When to Use

✅ USE this skill for:

  • Writing unit tests for utilities and functions
  • Creating component tests with React Testing Library
  • Setting up mocks for API calls, databases, or external services
  • Integration testing patterns
  • Understanding test coverage and CI setup

❌ DO NOT use for:

  • Jest-specific patterns → similar but check Jest docs for differences
  • End-to-end testing → use Playwright or Cypress skills
  • Performance testing → use dedicated performance tools
  • API contract testing → use OpenAPI/Pact patterns

Test Infrastructure

Configuration: vitest.config.ts

  • Environment: jsdom
  • Setup file: src/test/setup.ts
  • Coverage: v8 provider

Commands:

npm test              # Watch mode
npm run test:run      # Single run
npm run test:coverage # With coverage

File Organization

Sponsors

Details

Repository
github.com/erichowens/some_claude_skills
Category
Testing & QA
First seen
Jun 3, 2026

More from erichowens/some_claude_skills

All 73
1shipshitdev avatarplaywright-e2e-initshipshitdev/libraryplaywright e2e init166skills.sh installs
2absolutelyskilled avatarjest-vitestabsolutelyskilled/absolutelyskilledjest vitest140skills.sh installs
3absolutelyskilled avatarcypress-testingabsolutelyskilled/absolutelyskilledcypress testing136skills.sh installs
4steipete avataropenclaw-qa-testingsteipete/clawdisopenclaw qa testing126skills.sh installs
5shipshitdev avatarhusky-test-coverageshipshitdev/libraryhusky test coverage116skills.sh installs
6softaworks avatarqa-test-plannersoftaworks/agent-toolkitGenerate comprehensive test plans, manual test cases, regression test suites, and bug reports for QA engineers. Includes Figma MCP integration for design valida4.4Kskills.sh installs