What unit testing framework should I choose for javascript development, if such a thing exists.

It should ideally (in rough order of priority):

  • facilitate the repeated testing of user interface elements such as complicated forms*
  • be as simple as possible to create new tests
  • output it's results in a place which is nicely formatted or is easy to format
  • support the test driven development paradigm
  • fit in with the good parts, as described by Douglas Crockford
  • play nicely with popular tools such as angular, ember, meteor and backbone.
  • work with vanilla javascript without the use of third party frameworks like jQuery (though a strong case can be made to negate this requirement)

This is a a lot of 'nice to haves', consider it as an ideal wishlist, the best solution will hit as many of these as possible.

Where it runs from is not an issue really, assume the developer is at the level where they are well versed in OOP / js etc. and at a level to seriously tackle more advanced concepts like TDD.

*a real world example of where i see huge productivity gains could be acheived is a form with at least thirty fields at work that was tested manually ~1000 or more times - this is what I mean by testing user interface elements


4 Answers 4


My team used Jasmine. It's one of the first JS testing frameworks that appeared on the scene, and it's still in active development.

Writing tests with it is easy, it just takes some statements. If you are doing TDD, that's probably something you probably care about, since you don't want to spend all your time writing tests, or soon you'll get tired of it.

It uses a little bit of functional style, which might not be what your average OOP coder is used to, but if you are dealing with JavaScript, so there's little escape from it.

It does not have external dependencies, so no jQuery needed.

Have a look at the doc and see if it fits your needs for checking lots of fields.


I would suggest mocha, standalone can support all your stuff. You can either use it node with zombiejs(though, becareful, no rendering there) or use on browsers with karma.


I recommend Cypress, which we use on a big project. Cypress builds on top of Mocha and adds a enough of convenience to allow all our QA engineers to write tests with little training needed.

(Though we're adding one more layer of abstraction on top, because our bottleneck is the translation between test scenario documents and test code. Our project's codename is "modular t".)

  • 1
    Had Cypress existed and I knew of it when I wrote this question, I don't think I'd even have asked this question!
    – Toni Leigh
    Commented May 6, 2020 at 13:40

I found qUnit perfectly usable.

It displays the results as a webpage, though I guess if you really wanted you could hack it to pass the results somewhere else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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