- Mastering React Test:Driven Development
- Daniel Irvine
- 235字
- 2021-06-24 14:45:02
Commit early and often
The second sentence of that command output (You should commit this file) is a good cue for us to commit for the first time.
TDD provides natural breakpoints for you to commit code. If you’re starting out with TDD, I’d recommend committing to source control after every single test. That might seem like overkill for your projects at work, but as you're learning, it can be a very effective tool.
If you've ever watched The Weakest Link, you'll know that contestants can choose to bank their winnings at any time, which decreases their risk of losing money but reduces their earning potential. With git, you can use git add to effectively bank your code. This saves a snapshot of your code but does not commit it. If you make a mess in the next test, you can revert to the last banked state. I tend to do this after every test. And, unlike in The Weakest Link, there's no downside to banking!
Committing early and often simplifies commit messages. If you have just one test in a commit, then you can use the test description as your commit message. No thinking is required.
If you're using git, use the following commands to commit what you’ve done so far:
git init
echo "node_modules" > .gitignore
git add .
git commit -m "Blank project with Jest dependency"
- 編程的修煉
- Computer Vision for the Web
- Learning Selenium Testing Tools with Python
- YARN Essentials
- Instant QlikView 11 Application Development
- Java深入解析:透析Java本質(zhì)的36個(gè)話題
- Python機(jī)器學(xué)習(xí)實(shí)戰(zhàn)
- Bootstrap 4:Responsive Web Design
- Linux命令行與shell腳本編程大全(第4版)
- Spring快速入門
- C#應(yīng)用程序設(shè)計(jì)教程
- ExtJS高級(jí)程序設(shè)計(jì)
- ASP.NET開發(fā)與應(yīng)用教程
- ExtJS Web應(yīng)用程序開發(fā)指南第2版
- App Inventor少兒趣味編程動(dòng)手做