Skip to content

Instantly share code, notes, and snippets.

@Nalini1998
Created April 20, 2023 18:50
Show Gist options
  • Save Nalini1998/135ad6b2afbb9e9a00af876c9e3a5d2b to your computer and use it in GitHub Desktop.
Save Nalini1998/135ad6b2afbb9e9a00af876c9e3a5d2b to your computer and use it in GitHub Desktop.
Install Mocha Part II
#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.
@Nalini1998
Copy link
Author

image

@Nalini1998
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment