AGENT SKILL
qa-snapshot-tests
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-11-06
- Stars
- ★ 8
- Forks
- 0
02 资源文件 1
- 参考文档evals.json686 B
03 SKILL.md 正文
qa-snapshot-tests
The snapshot is a cheap spec, but only if every update is reviewed — auto-accepting diffs turns tests into rubber stamps.
What you do
Lock a serialized or rendered output as a committed artifact, small enough to read in review. Every change is a human decision — never a blind --updateSnapshot.
- Snapshot stable, semantic outputs (normalized JSON, serialized AST, component tree) — not raw timestamps, GUIDs, or ordering-sensitive hashes.
- Normalize noise with custom serializers (redact dates, sort keys, strip addresses).
- Keep snapshots small: if a file is 500+ lines, the test proves nothing a reviewer can verify.
- Prefer inline snapshots for small outputs — the test and its expectation live together.
- Document the update policy: who approves updates, what counts as a legitimate change.
- Pin a review checklist so snapshot PRs get human eyes, not a thumb-up.
Output shape
A test suite plus a short policy doc:
- Snapshot tests — one test per serialized unit, normalized.
- Custom serializers — shared module that scrubs nondeterminism.
- Update policy —
snapshot-policy.md: when to update, who reviews, what's suspect. - Review checklist — two-line checklist referenced in PR template.
- Rot guard — a test or lint that flags snapshots untouched for > N months (optional but recommended).
Anti-patterns
- Auto-updating on diff — the test passes but nobody read the change.
- Massive snapshots — 1000-line dumps that reviewers skim.
- Snapshots as spec — using them as the only proof of behavior that deserves explicit assertions.
- Unnormalized timestamps, GUIDs, or iteration order — flaky by construction.
- Snapshot sprawl — every test is a snapshot; behavior is unreadable.
- No update policy — every dev updates snapshots on local failure.
Handoff
Return the test suite path and policy doc path to the invoking qa specialist. If snapshots keep churning, the qa agent chains into qa-flaky-test-hunter (nondeterminism) or back to the owning service to fix the underlying source of churn. This skill does not dispatch.