Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

closed as not constructive by gnat, Yusubov, Robert Harvey, Walter, StuperUser Dec 5 '12 at 13:50

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 3 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
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.