I'm about to participate in a Coding Kata and I would like to do it in JavaScript.

What tools and libraries do I need for TDD in JavaScript?


It sounds like you are looking for a JavaScript boilerplate project. A boilerplate project gives you all the tools you need to be instantly productive. Since you are looking to use Test Driven Development (TDD) you'll need a unit testing framework included. Here are some recommendations (the ones I like towards the top):

  • Yeoman is a robust and opinionated set of tools, libraries, and a workflow that can help developers quickly build beautiful, compelling web apps.

  • Backbone Boilerplate - This is a great starting place if you want to build a single page app with Backbone.

  • Foundation 3 - The most advanced responsive front-end framework in the world.

  • Search google for "JavaScript boilerplate" to find your own perfect fit.


I have had fantastic luck with Jasmine and Sinon JS frameworks. We use these tools now and even have them hooked into TFS to automate the test running when our server is being built. TFS kicks off Sinon and Jasmine. Take a look at them. Jasmine is more of a BDD framework and Sinon the unit testing. We also use QUnit on a couple projects.


I recently began playing around with Jasmine and Mocha. Although they're very easy to write (and to read too) they're a mess to work with. I also found Test'em scripts, which is a small Node.js application that automatically tests your Jasmine/Mocha scripts.

Both of them are great, and paired with Testem, they make Javascript/Coffeescript/ very, very easy. Also, if you want to get started quickly, check nettuts screencast (No links left, sorry!) on Testem/Jasmine/Mocha. That's what got me interested on all of them in the first place.

  • Interesting. I never used Test'em scripts before. I might have to give this a shot myself. I recently have looked into Google's Testacular (horrible name!) and I am impressed with what I see. It too is a Node.js based test runner. – Akira71 Dec 3 '12 at 23:28
  • It's very cool and it definitely makes it easier to test Javascript code. I don't know Testacular, though I agree that it has a horrible name. I'll check it out too. – Heldraug Dec 4 '12 at 22:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.