Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
coverage-average
Advanced tools
Compute the average coverage from istanbul text-summary.txt files, exit 1 if below threshold
Computes the average coverage from a text-summary file like:
=============================== Coverage summary ===============================
Statements : 94.55% ( 52/55 )
Branches : 100% ( 6/6 )
Functions : 85% ( 17/20 )
Lines : 94.44% ( 51/54 )
================================================================================
Use it in your CI builds to force a failure if test coverage falls below your desired percentage.
Output average:
$ coverage-average path/to/text-summary.txt
Coverage average is 93.50%
Output average, exit 1 if average is below threshold
$ coverage-average path/to/text-summary.txt --limit 95
FAIL Coverage average of 93.50% is below limit of 95.00%
$ coverage-average path/to/text-summary.txt --limit 90
PASS Coverage average of 93.50% is above limit of 95.00%
To have this module calculate the average coverage based on karma-coverage generated results, use a karma.conf.js file similar to:
module.exports = function(config) {
config.set({
frameworks: ['jasmine'],
files: [
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'src/**/*.js,
'test/unit/**/*.js'
],
browsers: ['PhantomJS'],
reporters: ['dots', 'coverage'],
preprocessors: {
'src/**/*.js': ['coverage']
},
plugins: [
'karma-phantomjs-launcher',
'karma-coverage',
'karma-jasmine'
],
coverageReporter: {
reporters: [{
type: 'text-summary',
subdir: '.',
file: 'text-summary.txt'
}]
}
});
};
The summary file will be located at coverage/text-summary/text-summary.txt
.
Calculate the average with:
$ coverage-average coverage/text-summary/text-summary.txt` --limit 95
See sn-sticky-table-header for a working example.
FAQs
Compute the average coverage from istanbul text-summary.txt files, exit 1 if below threshold
The npm package coverage-average receives a total of 0 weekly downloads. As such, coverage-average popularity was classified as not popular.
We found that coverage-average demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.