-
Notifications
You must be signed in to change notification settings - Fork 191
3.5 Testing with lab and code
Make sure lab and code are installed.
Install Instructions
Make directory and files:
./test/index.js
./test/version.js.
- step1: Configure package.json to allow npm to execute needed test commands.
npm run syntax allows you to run custom commands with npm.
This package.json illustrates npm run syntax
"scripts": {
"start": "node start.js",
"test": "lab",
"test-coverage": "lab -t 100",
"test-coverage-html": "lab -r html -o test/coverage.html"
},
The above part of the package.json file allows you to run commands like:
npm test // This executes: lab without %100 coverage.
npm run test-coverage // executes:lab -t 100
- step2: Use Makefile to simplify the commands you run.
Important: put ".PHONY: all test clean" in your make file to ensure the
command "make test" does not conflict with the ./test directory.
See Sample Makefile
-
Make sure you get 100% coverage.
-
Important: Use your Makefile commands as short cuts to execute your tests.
For example:
make test (should run your tests)
make cov (should run your coverage tests)
See Sample Makefile
Based on conversation with @chyld as a general rule or best practice to not export
values from plugins just to get tests to pass. While doing this assignment it seemed
that many of us wanted to do this. But, this should be avoided.
If you are exporting values just to get your tests to pass then do not export it. and
find another way.
@TheAlphaNerd Assignment3
@Chyld Assignment3
@idanwe Assignment3
@zoe-1 Assignment3
Assignment 1
Assignment 2
Assignment 3
- 3.0 Objectives
- 3.1 Start
- 3.2 Configure for Travis
- 3.3 Install Packages
- 3.4 Refactor startup process
- 3.5 Testing with lab and code
Assignment 4
Assignment 5
Assignment 6
Assignment 7