🥼
Test-Driven Development
If you're sloppy with testing, you will never be again, once you are a convert in Kent Beck's TDD church.
The red, green, refactor approach helps developers compartmentalize their focus into three phases:
Red — think about what you want to develop. Green — think about how to make your tests pass. Refactor — think about how to improve your existing implementation.
Test-driven development is a practice that a lot of people swear by. I'm a 50/50 person myself—sometimes it makes sense to me, sometimes I just write the tests after I feel I'm out of the weeds when it comes to the first implementation. No need to be a fundamentalist; be a pragmatist! The important thing is that there are tests, not so much how and when they came. I'd still note that for this advice, I will assume that you have some kind of rigid standards—it's just too easy to skip the tests!
However, in case you want to be a good-spirited TDD crusader then I've made it easy to do so.
🎯 Example: Just run
npm run test:unit:watch
and Jest will watch your tests and source code. You can also modify what Jest "watches" in the interactive dialog.Last modified 1yr ago