一键导入
testing-guidelines
Testing conventions for divine-web. Load when writing or modifying tests, or when verifying changes with Vitest or Playwright.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Testing conventions for divine-web. Load when writing or modifying tests, or when verifying changes with Vitest or Playwright.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Install Cloudflare skills and MCP servers for this agent. Load when you need to set up or verify Cloudflare agent tooling. The URL below is the canonical, always-current source of truth.
Coding style and naming conventions for divine-web. Load when writing or editing TypeScript, React components, hooks, or styles.
Commit and pull request conventions for divine-web. Load when creating commits, writing PR descriptions, or preparing branches for review.
Project structure and file organization for divine-web. Load when creating new files, moving code, or navigating the codebase.
Render a page component directly at subdomain root (/) without URL redirect in React Router SPAs. Use when: (1) Subdomain should show content at / instead of redirecting to /profile/id or similar, (2) User sees blank page because component relies on useParams() but there's no route param at /, (3) Want username.domain.com/ to feel like a personal website without /profile/xyz in the URL. Pattern involves edge-injected global data + component fallback to that data when route params missing.
| name | testing-guidelines |
| description | Testing conventions for divine-web. Load when writing or modifying tests, or when verifying changes with Vitest or Playwright. |
Unit tests use Vitest with jsdom. Component tests use
@testing-library/react. Global setup lives in src/test/setup.ts.
Test files colocate with source: *.test.ts for utilities, *.test.tsx for
components.
npm run test runs type-check, lint, vitest, and build. Use this before
pushing.vitest run for tests only.vitest for watch mode during development.npm run test:visual runs Playwright visual regression tests.npm run test:visual:update updates visual snapshots.Favor user-facing assertions: getByRole, getByText, getByLabelText,
getByPlaceholderText. Query by what the user sees and interacts with.
Avoid testing implementation details. No direct state access. No querying by
data-testid unless no user-facing alternative exists.
Mock browser APIs (window.location, fetch, IntersectionObserver, etc.) as
needed. Use vi.fn() for spies and vi.mock() for module mocks. Keep mocks
minimal and scoped to the test file. Reset mocks between tests with
vi.restoreAllMocks() or per-test cleanup.
Tests must be deterministic. No relying on real timers, network calls, or
shared mutable state. Use vi.useFakeTimers() for time-dependent logic.
Isolate each test so it can run independently in any order.
it.skip('description #123').