Added karma threshold reporting & failure

This patch adds unit test coverage threshold reporting, adding
statement, branch, function, and line coverage to the console
output in infra, and failing the build if the threshold has not
been met.

The threshold values have been set to the current observed
coverage values - future patches should update this up as
coverage improves.

Closes-Bug: 1487109
Change-Id: Ie83ebf5d976b3538e3528787b05de3e83df18af8
This commit is contained in:
Michael Krotscheck 2015-08-17 12:03:21 -07:00 committed by Rob Cresswell
parent ba980a5f13
commit c50acff6d8
3 changed files with 23 additions and 4 deletions

View File

@ -133,18 +133,27 @@ module.exports = function (config) {
exitOnResourceError: true
},
reporters: ['progress', 'coverage'],
reporters: ['progress', 'coverage', 'threshold'],
plugins: [
'karma-phantomjs-launcher',
'karma-jasmine',
'karma-ng-html2js-preprocessor',
'karma-coverage'
'karma-coverage',
'karma-threshold-reporter'
],
coverageReporter: {
type: 'html',
dir: '../.coverage-karma/'
},
// Coverage threshold values.
thresholdReporter: {
statements: 86, // target 100
branches: 68, // target 100
functions: 87, // target 100
lines: 87 // target 100
}
});
};

View File

@ -143,18 +143,27 @@ module.exports = function (config) {
exitOnResourceError: true
},
reporters: ['progress', 'coverage'],
reporters: ['progress', 'coverage', 'threshold'],
plugins: [
'karma-phantomjs-launcher',
'karma-jasmine',
'karma-ng-html2js-preprocessor',
'karma-coverage'
'karma-coverage',
'karma-threshold-reporter'
],
coverageReporter: {
type: 'html',
dir: '../.coverage-karma/'
},
// Coverage threshold values.
thresholdReporter: {
statements: 93, // target 100
branches: 93, // target 100
functions: 93, // target 100
lines: 93 // target 100
}
});
};

View File

@ -17,6 +17,7 @@
"karma-jasmine": "0.3.5",
"karma-ng-html2js-preprocessor": "0.1.2",
"karma-phantomjs-launcher": "0.2.0",
"karma-threshold-reporter": "0.1.15",
"phantomjs": "1.9.17"
},
"scripts": {