I do version control with Git, and unit testing with QUnit. Sometimes I find a bug in my software that was not present in a past version. It’s easy for me to write a unit test specifically for that bug.
Given that unit test, can I easily go trough all my past commits and test the build with that unit test, so that I can pinpoint which commit caused the breakage?
Use
git bisectfor this, please see this page.Since you’re testing JavaScript, you will probably have to run the tests by hand and run
git bisect goodandgit bisect badas appropriate. However, if you can run your unit test from the command line, then you can usegit bisect runto have Git execute the test repeatedly and track down the faulty commit automatically:That’s pure magic the first time you see it! 🙂