Golden Files
ELI5 — The Vibe Check
Golden files are saved 'known good' outputs that you compare against on each test run. If the output changes unexpectedly, the test fails. It's like snapshot testing but for any output — HTML, images, API responses. When the change is intentional, you update the golden file.
Real Talk
A testing technique where expected test output is stored in 'golden' files that serve as the reference for comparison. On each test run, actual output is compared against the golden file. When legitimate changes occur, golden files are explicitly updated. Also known as 'blessed files' or 'reference files.'
When You'll Hear This
"Run with --update-golden flag to regenerate the golden files after the intentional schema change." / "Golden file tests caught the unintentional change in our API response format."
Related Terms
Approval Testing
Approval Testing captures the output of your code and compares it to a pre-approved 'golden file.
Regression Test
A regression test is a test you write AFTER fixing a bug, to make sure that bug never comes back.
Snapshot Test
A snapshot test takes a photo of your component's output and saves it. Next time you run it, it takes another photo and compares them.
Visual Regression Test
A visual regression test takes a screenshot of your UI, and next time it checks if anything LOOKS different — pixel by pixel.