The testing trophy for Nuxt: Vitest, component tests with @nuxt/test-utils, Playwright, API tests, quality gates in CI.
Pages
- Unit tests with VitestVitest 5 essentials — projects, matchers, spies and mocks, fake timers, snapshots, type tests, coverage — and how to unit-test the parts of a Nuxt app that need no DOM — utilities, composables, Pinia stores, Leitner scheduling — with MSW for network boundaries.
- Component testsVue Test Utils versus Testing Library, the Nuxt Vitest environment with mountSuspended and renderSuspended, mocking auto-imports, components and endpoints, testing async setup and Suspense, emitted events and slots, stores with createTestingPinia, and when Vitest browser mode is worth it.
- End-to-end with PlaywrightPlaywright's model — locators, auto-waiting, web-first assertions, fixtures, tracing — applied to Nuxt through @nuxt/test-utils/e2e and the Playwright fixture, with reusable auth state, network mocking, hydration checks, accessibility and visual assertions, sharding and a flake policy.
- Server and API testsTesting Nitro routes at three levels — handler logic in isolation, routes through @nuxt/test-utils/e2e, and contracts against an OpenAPI document — with databases in tests (SQLite in memory, Testcontainers, transaction rollback), seeding and isolation, auth in tests, and validation and error-shape assertions.
- Quality gates and CIDesigning the pipeline — stage order, caching, sharding and parallelism, what blocks a merge — plus coverage policy, flake management, accessibility and performance budgets, visual regression, type and mutation tests, preview deployments, and the test-data and environment story.
Notes for the whole section