Introduction to unit testing in JavaScript with Jasmine, using the classic FizzBuzz problem.
-
Run
npm init
to createpackage.json
file. -
Run
npm install --save-dev jasmine
to install Jasmine locally and save as a dev dependency. -
Add
"test-init": "./node_modules/jasmine/bin/jasmine.js init"
to scripts inpackage.json
. -
Add
"test": "./node_modules/jasmine/bin/jasmine.js"
to scripts inpackage.json
. -
Run
npm run test-init
to initialize Jasmine.
- Run
npm test
from the project root.