Testing

From dlupiak/claude-session-dashboard · View interactive version

Testing is an AI agent skill from the GitHub repository dlupiak/claude-session-dashboard. Vitest and Playwright testing patterns, conventions, and gotchas for this project.

How to use this skill

Skill file

Testing Patterns

Vitest (Unit + Integration)

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

Playwright (E2E)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.