πŸ₯Ό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.

β€” From Codeacademy

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 updated