nextjs-testing
БесплатноБез исполняемых скриптовНе проверен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…
от HoangNguyen0403★ 598 звёзд на GitHubОб этом скилле
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
[WEB-TEST-02..04]Core Web Standards: Accessible roles (getByRole), no prop/state inspection, and MSW network mocking are owned by the canonical web rules inreact-testing; naming is canonical A11.[WEB-TEST-06]Ban Static Artifact Pinning & Twin.test.jsSuites: Never assert staticprint(GQL)query text or.loc.source.bodysubstrings (GUARD-TS-STATIC-PINNING); test the hook or query component. Never loopObject.keys(locales/*.json)or asserttypeof en[k] === 'string'; assert rendered text viafindByText/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
- Existing projects (Pages Router / legacy): Jest (
jest@29+babel-jest+jest-environment-jsdom). - New projects (App Router): Vitest for speed and native ESM.
- E2E Testing: Playwright for full user flows (login, checkout).
Implementation Guidelines
- Unit & Component: Jest or Vitest with RTL, AAA; reuse existing companion test files.
- Interactions & Selectors:
userEvent(async) for actions;getByRole/findByRolefor accessibility;data-testidonly as fallback. - Networking: MSW handlers at API boundaries for deterministic component/unit tests; real network only in Playwright E2E.
- TS Hygiene: Apply canonical rule A6 (
GUARD-TS-FLOATING-ASSERT,GUARD-TS-CATCH-ONLY,GUARD-TS-CONDITIONAL-ASSERT,GUARD-TS-SELF-MOCK). - No Hard Timeouts: Ban
setTimeoutin unit tests (GUARD-REACT-02); banpage.waitForTimeoutin Playwright (GUARD-E2E-01). Use web-first assertions (await expect(locator).toBeVisible()) orfindBy*. - Reporting: Generate JSON coverage reports for CI gates; verify risk-weighted behavioral paths, not percentage padding.
Anti-Patterns
- Static pinning & twin suites (
[WEB-TEST-06]):GUARD-TS-STATIC-PINNINGregex pinning, locale JSON key loops,GUARD-TS-DUAL-EXTsidecars, and pass-through mock echoes. - Hard sleep calls (
GUARD-REACT-02/GUARD-E2E-01):setTimeoutin unit tests,page.waitForTimeoutin E2E. - Unisolated network in unit tests: Use MSW handlers; no external network.
- Implementation testing: Test user behavior, not internal component methods.
- Global state leakage: Reset MSW handlers and mocks after each test.
References
Установить nextjs-testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл nextjs-testing?
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.
Как установить скилл nextjs-testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл nextjs-testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic