Mocha and Chai

Mocha

  • Mocha is a JavaScript Test Framework.
  • Runs on Node.js and Browser
  • Installation: (Run the below commands in terminal or cmd)

—- global helps to install the Mocha on the computer at a global level which helps to run the mocha test through the command line.

—- save-dev helps to add the mocha as a dependency in the package.jsonfile for that particular project.

 

Chai

  • Chai is BDD/TDD assertion library.
  • Can be paired with any javascript testing framework.
  • Assertion with Chai provides natural language assertions, expressive and readable style.
  • Installation: (Run the below commands in terminal or cmd)

 

Example: test.js

 

Command to run

Leave a Reply

Your email address will not be published. Required fields are marked *