Setting up mocha

Course Home | Download and Install Mocha

Installation of Mocha is straight forward and done via Node package manager (NPM). To install execute the following command in your terminal or command line:

npm install --global mocha

The global parameter means that rather than installing Mocha to a local folder within your project root folder, Mocha is installed in your home directory and can then be used in your terminal or command line at any time against any project.

You can test this out by opening a new terminal/command line window and calling Mocha to see if it’s installed correctly:

> mocha --version

Next Lesson ➔

Mark Winteringham's photo

Mark Winteringham


Mark Winteringham is a tester, toolsmith and the Ministry of Testing DojoBoss with over 10 years experience providing testing expertise on award-winning projects across a wide range of technology sectors including BBC, Barclays, UK Government and Thomson Reuters. He is an advocate for modern risk-based testing practices and trains teams in Automation in Testing, Behaviour Driven Development and Exploratory testing techniques. He is also the co-founder of Software Testing Clinic a community raising awareness of careers in testing and improving testing education. You can find him on Twitter @2bittester.