Mocha runs independently from the [assertion library](http://visionmedia.github.io/mocha/#assertions), so you can choose which assertion format works best for you. Mocha most often is run in combination with assertion library [Chai](http://chaijs.com).
Ranked in these QuestionsQuestion Ranking
Pro Tests run in the order they're added to the suite
In cases where you want (I know your test cases must be atomic) where you really really want your test cases to run in a specific order, maybe if the current one rely on those of previous case, you can use Qunit by setting QUnit.config.reorder = false and your test cases will run in the order you've provided.
Pro Works really well if performing DOM Testing
All frontend developers already know the ease that jQuery framework has brought to their lives, in handling DOM events and accessing elements. Since Qunit was built as a part of jquery (is even used by jQuery itself for unit testing) hence it makes testing of DOM elements a lot easier.
Pro Extremely easy to start from scratch
Seriously! All you have to do is include the Qunit library from the CDN, then create your Testcases js file, and RUN IT! . Your outputs would be displayed in a pretty little format in your browser.
Pro Write tests with Behavior Driven Development (BDD)
Allows developers to choose their development process. Not only TDD but also BDD.
Pro Custom full color test reporters
Mocha has multiple test reporters built in and you can create your own as well. The test reporters have full color and makes it easy to see if your tests fail or not.
Pro Makes Asynchronous testing extremely easy
No need to write tricky statements for Async testing. Mocha gives you a
done callback. Place this
done parameter in your callback function, that'll let Mocha know that you've written an asynchronous function.
Pro Integrates really well with NodeJS
The Mocha test framework itself runs on NodeJS, hence it makes everything related to it extremely simple. With Mocha's simple syntax and speed, testing your node.js app just got a whole lot easier.
Pro Runs in Node.js and the browser
Mocha has a browser build as well as a node command line program so you can test in client and server side environments.
Pro Easy to add support for Generators
Aside from the numerous benefits with generators in your application, You can now also integrate generators into your test suite. By using mocha, all you have to do is enable support for generators.
Con Testing of Async operations can be a little tough at times.
Qunit, expects us to call the start() function before the Async function itself, and stop() after it stops. This can be a problem when you have no way of knowing, when your function will start or stop (your testing a number of dependent functions)
Con No atomic tests
Tests cannot be ran in random order.
Con Can be intimidating for beginners
While some testing frameworks are complete out of the box, Mocha requires developers to select and set up assertion libraries and mocking utilities. For someone who is just starting to learn how to build tests this can be scary as they will also have to choose which libraries to use and learn them too.