Created
April 20, 2023 18:50
-
-
Save Nalini1998/135ad6b2afbb9e9a00af876c9e3a5d2b to your computer and use it in GitHub Desktop.
Install Mocha Part II
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#How to install Mocha Part II? | |
1. After installing Mocha as a dependency we can run it in two ways. | |
+ The first (and more tedious) method is to call it directly from node_modules: | |
` | |
$ ./node_modules/mocha/bin/mocha | |
` | |
+ The second (and recommended) method is to add a script to package.json. In the scripts object in package.json, set the value of "test" to mocha. It should look like this: | |
` | |
"scripts": { | |
"test": "mocha" | |
} | |
` | |
Now you can call Mocha with the following command: | |
` | |
$ npm test | |
` | |
Instead of manually running each test in the test directory, you can use this command to run the full test suite automatically. |
Author
Nalini1998
commented
Apr 20, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment