Agent skill
testing
Vitest and Playwright testing patterns, conventions, and gotchas for this project.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/testing-dlupiak-claude-session-dashb
SKILL.md
Testing Patterns
Vitest (Unit + Integration)
- Config lives in
apps/web/vite.config.ts(no separate vitest.config) - Run:
npm run testfromapps/web/ - Run single file:
npx vitest run path/to/file.test.ts
vi.mock Gotcha (IMPORTANT)
vi.mock() is hoisted to the top of the file. You CANNOT reference variables declared above it:
// BAD — will be undefined
const mockFn = vi.fn()
vi.mock('./module', () => ({ doThing: mockFn }))
// GOOD — define inline
vi.mock('./module', () => ({ doThing: vi.fn() }))
import { doThing } from './module'
// Now doThing is the mock — use it for assertions
Rules
- Test behavior, not implementation
- Prefer integration tests over unit tests
- Mock external services, not internal functions
- "close timed out" warning after Vitest is a known nitro issue — ignore
Playwright (E2E)
- Config:
apps/web/playwright.config.ts - Tests:
apps/web/e2e/ - Run:
npm run test:e2efromapps/web/ - Use
page.getByRole(),page.getByText()over CSS selectors
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?