Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
Ensuring Software Quality
Manual tests are time-consuming and error-prone
Range of automated tools available to help ensure quality is maintained
All tests are pass/fail
When running automated tests, a non-zero exit code means failure.
Script Aliases
Many commands require a path plus multiple parameters
Installed nodejs commands are in the node_modules/.bin directory
Avoid having to type these in full by creating script aliases
These are stored in the scripts object in the package.json file.
Examples of Script Aliases
"scripts": {
"test": "node_modules/.bin/jest --coverage",
"watch": "node_modules/.bin/jest --coverage --watchAll"
}
Running Code-Coverage as Pass/Fail
By default the jest code coverage tool returns 0 (pass)
To change this to a pass/fail test you need to tell it what the acceptable thresholds are
This should be added to the jest section in your package.json file.
Setting the Thresholds
"jest": {
"testEnvironment": "node",
"verbose": true,
"coverageThreshold": {
"global": {
"branches": 100,
"functions": 100,
"lines": 100,
"statements": -10
}
}
}
Parser Options
specify the JavaScript language options you want to support (defaults to ECMA5)
"parserOptions": { "ecmaVersion": 6,"sourceType": "module",}