Skip to content
Back to skills

Testing

ASecurity

Vitest and Playwright testing patterns, conventions, and gotchas for this project.

  • 66 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added May 26, 2026
testingtypescriptgotesting

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add dlupiak/claude-session-dashboard --skill testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dlupiak-testing/badge)](https://www.skillsdirectory.com/skills/dlupiak-testing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: testing
description: Vitest and Playwright testing patterns, conventions, and gotchas for this project.
user-invocable: true
---

# Testing Patterns

## Vitest (Unit + Integration)
- Config lives in `apps/web/vite.config.ts` (no separate vitest.config)
- Run: `npm run test` from `apps/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:

```typescript
// 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:e2e` from `apps/web/`
- Use `page.getByRole()`, `page.getByText()` over CSS selectors

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…