| name | testing-frontend |
| description | Write or run unit, component, and end-to-end tests for this Vite/React site (Vitest, React Testing Library, Playwright). Use when adding a test, fixing a failing test, deciding which test layer a change belongs in, or when the user mentions vitest, RTL, Playwright, e2e, or CI test failures. |
Testing (Vitest + RTL + Playwright)
Three layers, each with its own config — don't assume one covers the others.
| Layer | Config | Location | Command |
|---|
| Unit | test block in vite.config.ts | src/**/*.test.{ts,tsx} (any file) | npm run test:ci |
| Component (RTL) | vitest.config.components.ts | src/components/**/*.test.{ts,tsx} only | npm run test:components:ci |
| E2E | playwright.config.ts | e2e/*.spec.ts | npm run test:e2e |
Both Vitest configs use jsdom + src/setupTests.ts; the component config restricts include to src/components/ and switches to a dot reporter under CI. A test file under src/components/ runs under both the unit and component configs unless you're deliberate about that — that's expected, not a bug.
Current coverage
Only src/components/ui/button.test.tsx (component) and src/lib/markdown.test.ts (unit) exist today, against ~20 components, 11 pages, and several and modules. When asked to add tests for a component, check first whether an equivalent already exists — most don't.