Recs.
Updated
Specs
Pros
Pro Supports Promises
You can return a Promise from BDD hook methods (before
, beforeEach
, after
, afterEach
) and, with Chai as Promised, you can assert fluently against units under test that return Promises.
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 Supports different assertion libraries
Mocha runs independently from the assertion library, so you can choose which assertion format works best for you.
Mocha most often is run in combination with assertion library Chai.
Pro Supports programatically skipping tests
If your integration tests depend on an external system that may go down, you can programmatically skip tests using this.skip().
Cons
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.