2025, 30Oct = 24Dec I LOVED SNAPSHOTS IN 2016 A Decade Later, Let’s Revisit ROBIN POKORNY

TONIGHT 01 02 03 WHAT IS SNAPSHOT TESTING WHAT WENT WRONG WHAT NOW?

01 WHAT IS SNAPSHOT TESTING

02 WHAT WENT WRONG

‘The most common drawback is the fragility of snapshot tests’ —STIP PAPER

LACK OF DEVELOPER INTENTION Tests don’t encode what’s important GENERATED FILE PROBLEM Need manual verification LARGE SNAPSHOTS Developers don’t scrutinize them HIGH FALSE NEGATIVES Tests fail when code is actually fine

03 WHAT NOW?

USE ● ● ● ● ● API response structures (not UI) Error messages and CLI output for developer-facing tools Code transformations Small, stable components in design systems Legacy refactoring AVOID ● ● ● ● ● Large component trees Components with frequent changes “It renders” smoke tests (use linting instead) Testing behavior As primary testing strategy

https://selfie.dev

TAKEAWAY SNAPSHOTS PROVIDE VALUE WHEN USED EFFECTIVELY

WEB me@robinpokorny.com NAME IN/IG/YT Let’s connect

STATE OF JS https://survey.devographics.com/survey/state-of-js/2025