nextjs-testing
Installation
SKILL.md
Next.js Testing
Priority: P1 (HIGH)
Test Runner
- Existing projects (Pages Router / legacy stack): Use Jest (
jest@29+babel-jest+jest-environment-jsdom). - New projects (App Router): Use Vitest for speed and native ESM support.
Workflow: Test New Feature
- Write unit tests — Use Jest (or Vitest for new projects) + RTL with Arrange-Act-Assert pattern.
- Mock APIs — Set up MSW handlers for all fetch boundaries.
- Test interactions — Use
userEvent(async) for clicks, typing, form submissions. - Add E2E tests — Use Playwright for critical user flows (login, checkout).
- Verify coverage — Aim for 80%+ on core libraries via JSON coverage reports.