Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Would you recommend using Jest snapshots for *almost* everything? #275
This is regarding the tweet you've made here: https://twitter.com/kentcdodds/status/862343047258009604?refsrc=email&s=11
Questioning myself after reading this article: https://hackernoon.com/how-to-snapshot-test-everything-in-your-redux-app-with-jest-fde305ebedea
referenced this issue
May 19, 2017
I use snapshots for testing state reducers/updaters. The benefit is that I can treat the entire state of a component as a unit. If someone changes the state-shape, all updater functions are affected. It might seems like overkill, but we added an
Edit: I'm wondering how easy it is to onboard people on snapshot testing compared to equality checks. I find that snapshotting is a simpler concept to grasp for junior people.
That would require you and everyone on your team to have in their head the knowledge of how the state is supposed to look, and rely on having all your developers being awake (this is the major problem with snapshots, actually).
I think it's much better to be able to have a computer verify this.