Dev

Testing

Automated tests for pure logic, Nitro routes, Vue components, and critical browser flows. Tests live under tests/ at the repo root.

Stack

  • Vitest — unit, API, and component tests (vitest.config.ts)
  • @vue/test-utils — component mounting with Nuxt child stubs
  • Playwright — e2e smoke against production build (playwright.config.ts)

Test layers

LayerLocationExamples
Unittests/unit/**utils/seo, slugify, formatYoutubeUrl
API (Nitro)tests/api/**health.get, robots.txt
Componenttests/components/**FilterPills props and emits
E2Etests/e2e/**Home, beats, docs, health, robots smoke

Commands

npm test                              # All Vitest
npm run test:watch                    # Vitest watch mode
npx vitest run tests/unit/utils/seo.test.ts   # Single file
npm run test:e2e                      # Playwright (runs build:e2e first)
npm run test:all                      # Vitest + Playwright
npm run build:e2e                     # NITRO_PRESET=node-server nuxt build

Helpers

  • tests/helpers/nitro.tsbuildGetEvent, stubNitroGlobals, callHandler

Conventions

  • Mirror source paths under tests/ (e.g. utils/seo.tstests/unit/utils/seo.test.ts)
  • Use // @vitest-environment node for pure TS and Nitro handler tests
  • Component tests use happy-dom; stub Icon, NuxtLink, etc.
  • Do not hit production DB or live external APIs in unit/component tests
  • Gitignore: playwright-report/, test-results/

Deferred coverage

  • Express API handlers in api/ (future api/tests/)
  • Heavy composables (useAuth, useSocket, useGlobalAudio)
  • Howler / waveform player components

Cursor agent

Use the testing agent skill (.cursor/skills/testing-agent/SKILL.md) and rule (.cursor/rules/testing-agent.mdc) when adding coverage or fixing flaky tests.