- Jasmine is a unit testing framework. We will be using it to pass test cases to our algorithms to see if your algorithms return the expected result.
- you must have Node.js installed
git clone URL/TO/REPO.git(url can be found on the repos GitHub page by clicking the top right code button)- this will create a new folder at the location your terminal is open to, the folder will be named after the repository
cd repo_namenpm ito install the dependencies (jasmine) listed in thepackage.jsonthat came the cloned project.
- If you haven't already, run:
npm initin your algos project folder npm i jasmine- this should have created a
package.jsonfile that hasjasmineand version number listed in it.
- this should have created a
- copy over the spec folder, or to create your own
-
add the following to
package.json-
"scripts": { "test": "node_modules/.bin/jasmine" },
- this allows you to run
npm testin the terminal open to your project folder - alternatively, to test a single
Specfile:npm test path/to/fileNameSpec.js- you can type
npm testwith a space aftertest, then drag and drop the file after the space to auto fill the path
- you can type
- this allows you to run
-