Skip to content
Anna Paula Maule edited this page Jul 13, 2016 · 1 revision

Mocha

  1. Go to admin account

  2. Make sure to have Node JS installed just like for Karma/Travis/Jasmin set up

  3. Run

      npm config set strict-ssl false
      sudo npm install mocha 
    
  4. We need a library for assertions, as they are not natively supported in Mocha:

      npm install chai
    
  5. We also need a library for test doubles:

      npm install sinon
    
  6. Optionally, install Karma:

      npm install karma-mocha karma-firefox-launcher --save-dev
    
  7. Make a directory named 'test'. This is where the tests for your application should live.

  8. To run tests from the command line, type:

      mocha
    
  9. For test examples and more options, check out the official Mocha documentation. Also take a look at Mocha's awesome list of test reporters (especially the JSON reporter)

Clone this wiki locally