snapshot-golden-testing
Installation
SKILL.md
Snapshot / Golden-Master / Approval Testing
Record known-good output once; fail if it changes; a human reviews and approves intentional diffs. Best for large or hard-to-hand-assert outputs and for characterizing legacy code before refactoring.
Good uses
Serialized API responses (with volatile fields masked) · generated code/SQL/HTML/emails · CLI output · report/PDF text · AST/compiler output · component structure (small) · legacy behavior pinning.
Bad uses
Whole-page/large DOM snapshots (nobody reviews 800 lines) · anything with timestamps/IDs/random values · visual look (use visual-testing) · replacing meaningful assertions.
Tools
| Stack | Tool |
|---|---|
| JS/TS | toMatchSnapshot(), toMatchInlineSnapshot() (Jest/Vitest) |
| Python | syrupy, pytest-regressions, approvaltests |
| Rust | insta (cargo insta review) |
| Java/.NET | ApprovalTests, Verify (VerifyXunit) |
| Go | goldie, cupaloy, golden files + -update flag |