Karma is a really useful tool to speed up TDDing JavaScript. It is a node.js extension and it is really easy to set up.

Assuming you have npm installed, the steps are:

# Install Karma
$ npm install -g karma

# Go to your project folder and init Karma
$ cd ~/my_l33t_project
$ karma init

# Follow the instructions, choose your test suite, like Jasmine, and that will create a karma.conf.js file with its configurations.
# If everything goes well, you'll be able to start it with:
$ karma start

Detailed information can be found on Karma github page or the official page.

When starting, it will trigger a chrome window where the tests will be run on the background, the only thing you have to see is the console. Personally I use sizeUp to change the size of the windows so it’s possible to see the editor and the terminal at the same time. This way, there’s no need to keep switching between windows and refreshing the browser all the time.

Karma

Karma will watch your files for modifications and run the tests on every file save, and because it’s not running the whole browser, it’ll take a ridiculously small amount of time to run all the tests. Instant feedback on every Cmd + S. Awesome.