ワンクリックで
testing
Vitest + Testing Library patterns for unit/component tests, Playwright for e2e. Use when writing tests or adding test coverage.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Vitest + Testing Library patterns for unit/component tests, Playwright for e2e. Use when writing tests or adding test coverage.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
next-intl i18n conventions for the portfolio — locale routing, message catalogs (3 locales), translation helpers, locale switcher, and middleware locale detection. Use when adding or translating pages, adding message keys, or touching anything under src/i18n or messages.
Create a new page section/block component for this Next.js + next-intl portfolio, following the project's Server/Client split, i18n, and angular-frame design conventions. Use when asked to "add a section", "new block", "create a component for the page", "add About/Projects/Skills-style section", or build any new piece of the portfolio UI.
Add or use shadcn/ui components in this Next.js portfolio (New York style, Tailwind v4). Use when asked to "add a button/dialog/table/form", "install a shadcn component", "use a UI primitive", or build UI from shadcn components. Trigger on "shadcn", "ui component", "add a <component>".
Add or update internationalized (i18n) copy across all locales in this next-intl portfolio. Use whenever introducing or changing any user-facing string, label, section title, or data key. Trigger on "add text", "new copy", "translate", "add a key", "update wording", "i18n", "new section title", or any task that surfaces visible text.
Project file organization, naming conventions, and import patterns. Use when creating new files, organizing code, or deciding where to place modules.
React component patterns — server vs client components, styling with cn(), props interfaces. Use when creating page sections or shared components.
| name | testing |
| description | Vitest + Testing Library patterns for unit/component tests, Playwright for e2e. Use when writing tests or adding test coverage. |
| paths | ["src/**/*.test.{ts,tsx}","e2e/**"] |
Framework: Vitest + React Testing Library (jsdom).
Location: co-located *.test.ts / *.test.tsx next to the code they test
(the vitest glob is src/**/*.test.{ts,tsx}).
import { describe, it, expect } from 'vitest'
import { cn } from './utils'
describe('cn', () => {
it('dedupes conflicting tailwind classes (last wins)', () => {
expect(cn('p-2', 'p-4')).toBe('p-4')
})
})
import { describe, it, expect } from 'vitest'
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { Button } from '@/components/ui/button'
describe('Button', () => {
it('renders with text', () => {
render(<Button>Click me</Button>)
expect(screen.getByRole('button', { name: /click me/i })).toBeInTheDocument()
})
it('handles click events', async () => {
const user = userEvent.setup()
let clicked = false
render(<Button onClick={() => (clicked = true)}>Click</Button>)
await user.click(screen.getByRole('button'))
expect(clicked).toBe(true)
})
})
Wrap the component in NextIntlClientProvider with a minimal messages object so
useTranslations resolves:
import { NextIntlClientProvider } from 'next-intl'
import { render } from '@testing-library/react'
function renderIntl(ui: React.ReactElement, messages: Record<string, unknown>) {
return render(
<NextIntlClientProvider locale="en" messages={messages}>
{ui}
</NextIntlClientProvider>
)
}
src/**/*.test.{ts,tsx} (co-located).describe blocks; use it (not test) for cases.screen.getByRole() queries (accessibility-first).userEvent over fireEvent; always userEvent.setup() first.npm run test (watch) or npm run test:run (CI).console.log is allowed in test files (ESLint rule relaxed there).Framework: Playwright. Location: e2e/ at project root.
import { test, expect } from '@playwright/test'
test('home redirects to a locale and renders', async ({ page }) => {
await page.goto('/')
await expect(page).toHaveURL(/\/(en|es|fr|it|pt|ru|ja|ko|zh|ar|hi|de)\b/)
})
e2e/**/*.spec.ts; use test (Playwright convention).page fixture for page-level tests.npm run test:e2e. Config: playwright.config.ts (auto-starts the
dev server via webServer; Chromium only by default).