unit-testing

Installation
SKILL.md

Unit Testing Skill (Vitest)

Write fast, isolated unit tests with Vitest for TypeScript logic — utilities, Zod schemas, hooks, and Server Actions (with dependencies mocked). Unit tests do NOT render components in a browser (use the storybook-testing skill for that).

This file holds the rules. Code lives in the references:

  • references/examples.md — seven worked examples: pure utility, Zod schema, Server Action with mocked DB, transform function, parameterized (it.each), async error handling, hooks.
  • references/patterns.md — AAA, test isolation, mock boundaries, the vi.mock vs vi.fn vs vi.spyOn decision table, coverage targets, and anti-patterns.
  • references/mocking.md — the full mocking catalogue (factories, hoisting, partial/dynamic mocks, async, DB/auth/time/env recipes). Read before writing non-trivial mocks.

Global Test Utilities

This project enables global test utilities — do not import them:

Installs
10
GitHub Stars
1
First Seen
Apr 6, 2026
unit-testing — janszewczyk/claude-plugins