Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
karma-istanbul-threshold
Advanced tools
Karma reporter that checks coverage thresholds with coverage data generated by karma-coverage. Because it reads its data from a json file, it can also handle remapped coverage data provided by karma-remap-istanbul to allow source-map support.
Checks coverage thresholds by using json coverage files generated by Istanbul, karma-coverage or karma-remap-istanbul.
While karma-coverage already allows threshold checks, it unfortunately does not play well with source maps.
karma-remap-istanbul can convert results generated by karma-coverage but does not offer threshold checking.
This plugin fills that gap by using a json file for threshold checking that can be generated by Istanbul or karma-coverage (which internally uses Istanbul). Those json files can be remapped by karma-remap-istanbul to enable source-map support for threshold checking.
The easiest way is to install karma-istanbul-threshold
as a devDependency
,
by running
npm install karma-istanbul-threshold --save-dev
Add the plugin, reporter and reporter configuration in your karma.conf.js
.
{
plugins: ['karma-istanbul-threshold'],
reporters: ['progress', 'karma-istanbul-threshold'],
istanbulThresholdReporter: {
src: 'path/to/coverage-report.json',
basePath: path.resolve(__dirname, 'path/to/source'),
reporters: ['text'], // use 'text' reporter to get text reports like in the screenshot
//reporters: ['teamcity'], // use 'teamcity' reporter to generate output for teamcity
excludes: [
'some/module/*.ts' // will exclude .ts files in `path/to/source/some/module`
],
thresholds: {
global: {
statements: 90,
branches: 90,
lines: 70,
functions: 90,
},
each: {
statements: 80,
branches: 80,
lines: 60,
functions: 80,
},
},
}
}
karma-coverage
and karma-remap-istanbul
{
preprocessors: {
'build/**/!(*spec).js': ['coverage']
},
plugins: ['karma-remap-istanbul', 'karma-coverage', 'karma-istanbul-threshold'],
reporters: ['progress', 'coverage', 'karma-remap-istanbul', 'istanbul-threshold'],
// Creates coverage reports and stores as json
coverageReporter: {
reporters: [
{ type: 'json', dir: 'tmp/coverage', subdir: '.', file: 'coverage-unmapped.json' }
],
},
// Creates a source-mapped version of coverage report
remapIstanbulReporter: {
src: 'tmp/coverage/coverage-unmapped.json',
reports: {
'json': 'tmp/coverage/coverage-mapped.json'
},
},
// Uses source-mapped version to check coverage thresholds
istanbulThresholdReporter: {
src: 'tmp/coverage/coverage-mapped.json',
basePath: path.resolve(__dirname, 'path/to/source'),
reporters: ['text'],
thresholds: {
global: {
statements: 90,
branches: 90,
lines: 70,
functions: 90,
},
each: {
statements: 80,
branches: 80,
lines: 60,
functions: 80,
},
},
}
}
FAQs
Karma reporter that checks coverage thresholds with coverage data generated by karma-coverage. Because it reads its data from a json file, it can also handle remapped coverage data provided by karma-remap-istanbul to allow source-map support.
The npm package karma-istanbul-threshold receives a total of 349 weekly downloads. As such, karma-istanbul-threshold popularity was classified as not popular.
We found that karma-istanbul-threshold demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 open source maintainers 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.