Skip to main content

testing-guidelines

Testing conventions for divine-web. Load when writing or modifying tests, or when verifying changes with Vitest or Playwright.

소스 정보

저장소
divinevideo/divine-web
최근 소스 활동
2026년 5월 19일 05:26
감지된 SKILL.md 언어
영어
스타
50
포크
29

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
testing-guidelines
description
Testing conventions for divine-web. Load when writing or modifying tests, or when verifying changes with Vitest or Playwright.
# Testing Guidelines ## Frameworks and Setup 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. ## Running Tests - `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. ## Assertion Style 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. ## Mocking 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. ## Determinism 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. ## Rules - Do not commit failing tests. Fix before pushing. - Add or update tests alongside any feature change or bug fix. Tests are not optional. - If a test is temporarily skipped, it must have a linked issue: `it.skip('description #123')`.
GitHub에서 보기