Added Istanbul integration

This commits introduces integration with Istanbul which allows
to track code coverage.

Change-Id: Ia106b256308a8d0f7c286134f997c7efd4bcf624
Co-Authored-By: Michael Krotscheck <krotscheck@gmail.com>
This commit is contained in:
Vitaly Kramskikh
2016-07-14 17:23:31 +03:00
parent 46f2aff492
commit e8d39a4747
3 changed files with 50 additions and 2 deletions

30
.istanbul.yml Normal file
View File

@@ -0,0 +1,30 @@
verbose: false
instrumentation:
root: .
includes:
- 'src/**'
default-excludes: true
reporting:
print: detail
reports:
- lcov
- html
dir: ./cover/node
watermarks:
statements: [50, 90]
lines: [50, 90]
functions: [50, 90]
branches: [50, 90]
check:
global:
statements: 50
lines: 50
branches: 50
functions: 0
excludes: []
each:
statements: 50
lines: 50
branches: 50
functions: 0
excludes: []

View File

@@ -27,7 +27,7 @@ export default (config) => {
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
reporters: ['progress', 'coverage', 'threshold'],
// web server port
port: 9876,
@@ -59,6 +59,20 @@ export default (config) => {
webpackMiddleware: {
// Don't spam the console.
noInfo: true
},
// Generate a coverage report in /cover/karma
coverageReporter: {
type: 'html', //produces a html document after code is run
dir: 'cover/browser/' //path to created html doc
},
// The current coverage threshold values. These should never drop.
thresholdReporter: {
statements: 88,
branches: 64,
functions: 77,
lines: 75
}
});

View File

@@ -5,8 +5,9 @@
"main": "dist/index.js",
"scripts": {
"test": "npm run test:node; npm run test:browser",
"test:node": "jasmine JASMINE_CONFIG_PATH=test/unit/jasmine.json",
"test:node": "istanbul cover jasmine JASMINE_CONFIG_PATH=test/unit/jasmine.json",
"test:browser": "karma start",
"posttest:node": "istanbul check-coverage",
"lint": "eslint ./",
"prepublish": "nsp check; npm run build",
"build": "babel src -d dist && webpack",
@@ -34,11 +35,14 @@
"babel-register": "^6.9.0",
"eslint": "^2.4.0",
"eslint-config-openstack": "2.0.0",
"istanbul": "^1.0.0-alpha.2",
"jasmine": "^2.4.1",
"karma": "^1.1.1",
"karma-chrome-launcher": "^1.0.1",
"karma-coverage": "^1.1.0",
"karma-firefox-launcher": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-threshold-reporter": "^0.1.15",
"karma-webpack": "^1.7.0",
"nsp": "^2.4.0",
"webpack": "^1.13.1"