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.
2