Nextjs testing

From HoangNguyen0403/agent-skills-standard · View interactive version

Nextjs testing is an AI agent skill from the GitHub repository HoangNguyen0403/agent-skills-standard. Write Jest or Vitest unit tests with React Testing Library and Playwright E2E tests for Next.js projects. Use when testing components with RTL, mocking APIs with MSW, or creating Playwright user flow tests.

How to use this skill

Skill file

Next.js Testing

**Priority: P1 (HIGH)**

Universal anti-slop rules (naming, identity fixtures, tautologies, skip/focus, mock echoing, bug-first lock, sleeps,

shallow assertions, coverage): anti-slop-rules.md. Only Next.js

deltas follow.

Core Rule Anchors

are owned by the canonical web rules in react-testing; naming is canonical A11.

.loc.source.body substrings (GUARD-TS-STATIC-PINNING); test the hook or query component. Never loop

Object.keys(locales/*.json) or assert typeof en[k] === 'string'; assert rendered text via findByText/getByRole.

Never keep <stem>.test.ts(x) beside a legacy <stem>.test.js(x) (GUARD-TS-DUAL-EXT); migrate it. Ban pass-through mock

echoes (expect(wrapper()).toBe(X) without business transformations).

Test Runner & Workflow

Implementation Guidelines

as fallback.

GUARD-TS-CONDITIONAL-ASSERT, GUARD-TS-SELF-MOCK).

(GUARD-E2E-01). Use web-first assertions (await expect(locator).toBeVisible()) or findBy*.

Anti-Patterns

GUARD-TS-DUAL-EXT sidecars, and pass-through mock echoes.

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.