DEV Community

loading...

Discussion on: How to write tests for React in 2020 - part 2

Collapse
jkettmann profile image
Johannes Kettmann

Great writeup Kelvin! And thanks for mentioning the course. Really appreciated and I'm glad you liked it.

A quick note on snapshot testing: I was a big fan of them for a long time. But at some point, I realized that they often don't add a lot of value. What typically happens when you have a lot of snapshot tests is that you change some components, 20 snapshot tests fail, and at some point, you just start pressing "u" to update them without thoroughly checking the changes. In my last projects, the teams tended to migrate away from snapshot testing completely. Here's a nice blog post again by Kent that describes how snapshot tests can still be used effectively.

Collapse
kelvin9877 profile image
Kelvin Liang Author

Thanks for pointing this out and sharing your own experiences on that, Johannes, really appreciated and I totally agree with it.

However, I still think it would still be a good idea to introduce the test and show them how to do it in the simplest way. If anyone interested they can always find a way to learn more or they can move on the next topic with some basic knowledge to take away from.

Finally, I really like the discussion you bringing up here, not only other readers but also myself can learn a lot from it, Thanks you! (That is why I like to start writing down what I learn in the journey of learning to code)