- Download and install Node.js
- Run the command
npm --versionin the terminal and make sure it does return any errors. It should print out your version of Node's Package manager. For example: ➤ npm --version 3.3.12 - Run the command
npm install -g mochato install the test library. - Check that mocha is installed properly by running
mocha --version, which should print out the version of mocha that you have just installed.
- In the terminal, navigate to the folder containing this file on your computer.
- Run the command
mocha ./. You should see something like the following:
You can also let Mocha run tests for you automatically when your files change by running the mocha -w ./ command.
