How to install Mocha

Mocha is a feature-rich JavaScript test framework that runs on Node.js and in the browser; it simplifies the process of asynchronous testing. Mocha tests run serially to allow for flexible and accurate reporting while mapping uncaught exceptions to the correct test cases.

svg viewer

Installation

Mocha can be installed with npm globally:

npm install --global mocha

It can also be installed as a development dependency for your project:

npm install --save-dev mocha

Note that as of v6.0.0, Mocha requires Node.js v6.0.0 ​or newer.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved