karma-coverage
Advanced tools
Comparing version 2.0.3 to 2.2.0
@@ -0,1 +1,28 @@ | ||
# [2.2.0](https://github.com/karma-runner/karma-coverage/compare/v2.1.1...v2.2.0) (2022-02-10) | ||
### Features | ||
* update Istanbul packages ([24aac11](https://github.com/karma-runner/karma-coverage/commit/24aac11aacef75aab720f69aabaa9651cc770630)) | ||
## [2.1.1](https://github.com/karma-runner/karma-coverage/compare/v2.1.0...v2.1.1) (2022-02-05) | ||
### Bug Fixes | ||
* handle unexpected error when generating code coverage ([bca2c69](https://github.com/karma-runner/karma-coverage/commit/bca2c69d43332598acb30d8e5d6e26d783bc06fb)), closes [/github.com/karma-runner/karma/blob/c985155a4eac95c525e1217e98d4013ac5f53305/lib/server.js#L392](https://github.com//github.com/karma-runner/karma/blob/c985155a4eac95c525e1217e98d4013ac5f53305/lib/server.js/issues/L392) | ||
* race condition between the Karma shutdown and coverage writing ([44b31eb](https://github.com/karma-runner/karma-coverage/commit/44b31eba5a221e6e049b6dff426207f555b379e2)), closes [#434](https://github.com/karma-runner/karma-coverage/issues/434) | ||
# [2.1.0](https://github.com/karma-runner/karma-coverage/compare/v2.0.3...v2.1.0) (2021-12-01) | ||
### Bug Fixes | ||
* **deps:** update main and dev dependencies ([c20d982](https://github.com/karma-runner/karma-coverage/commit/c20d982607168ccc302f1cca576dbbbdac0a1af6)) | ||
### Features | ||
* **reporter:** log coverage threshold as a warning fixed [#432](https://github.com/karma-runner/karma-coverage/issues/432) ([a6c95d8](https://github.com/karma-runner/karma-coverage/commit/a6c95d8fb932a4191474e6504174df7bc9a6fe60)) | ||
## [2.0.3](https://github.com/karma-runner/karma-coverage/compare/v2.0.2...v2.0.3) (2020-07-24) | ||
@@ -2,0 +29,0 @@ |
@@ -91,5 +91,8 @@ # Configuration | ||
`emitWarning` allows to log exceeding coverage threshold into console as warning and not fail tests. | ||
```javascript | ||
coverageReporter: { | ||
check: { | ||
emitWarning: false, | ||
global: { | ||
@@ -96,0 +99,0 @@ statements: 50, |
module.exports = function (grunt) { | ||
grunt.loadNpmTasks('grunt-npm') | ||
grunt.loadNpmTasks('grunt-karma') | ||
grunt.initConfig({ | ||
pkgFile: 'package.json', | ||
simplemocha: { | ||
options: { | ||
ui: 'bdd', | ||
reporter: 'dot' | ||
}, | ||
unit: { | ||
src: [ | ||
'test/mocha-globals.js', | ||
'test/*.spec.js' | ||
] | ||
} | ||
}, | ||
'npm-contributors': { | ||
@@ -21,35 +11,2 @@ options: { | ||
}, | ||
conventionalChangelog: { | ||
release: { | ||
options: { | ||
changelogOpts: { | ||
preset: 'angular' | ||
} | ||
}, | ||
src: 'CHANGELOG.md' | ||
} | ||
}, | ||
conventionalGithubReleaser: { | ||
release: { | ||
options: { | ||
auth: { | ||
type: 'oauth', | ||
token: process.env.GH_TOKEN | ||
}, | ||
changelogOpts: { | ||
preset: 'angular' | ||
} | ||
} | ||
} | ||
}, | ||
bump: { | ||
options: { | ||
commitMessage: 'chore: release v%VERSION%', | ||
pushTo: 'upstream', | ||
commitFiles: [ | ||
'package.json', | ||
'CHANGELOG.md' | ||
] | ||
} | ||
}, | ||
karma: { | ||
@@ -64,17 +21,2 @@ coffee: { | ||
}) | ||
require('load-grunt-tasks')(grunt) | ||
grunt.registerTask('default', ['simplemocha', 'karma']) | ||
grunt.registerTask('release', 'Bump the version and publish to NPM.', function (type) { | ||
grunt.task.run([ | ||
'npm-contributors', | ||
'bump:' + (type || 'patch') + ':bump-only', | ||
'conventionalChangelog', | ||
'bump-commit', | ||
'conventionalGithubReleaser', | ||
'npm-publish' | ||
]) | ||
}) | ||
} |
@@ -14,2 +14,3 @@ // Coverage Reporter | ||
var path = require('path') | ||
const { promisify } = require('util') | ||
var istanbulLibCoverage = require('istanbul-lib-coverage') | ||
@@ -130,2 +131,3 @@ var istanbulLibReport = require('istanbul-lib-report') | ||
var coverageFailed = false | ||
const { emitWarning = false } = thresholds | ||
@@ -151,7 +153,9 @@ function check (name, thresholds, actuals) { | ||
} | ||
} else { | ||
if (actual < threshold) { | ||
} else if (actual < threshold) { | ||
const message = `${browser.name}: Coverage for ${key} (${actual}%) does not meet ${name} threshold (${threshold}%)` | ||
if (emitWarning) { | ||
log.warn(message) | ||
} else { | ||
coverageFailed = true | ||
log.error(browser.name + ': Coverage for ' + key + ' (' + actual + | ||
'%) does not meet ' + name + ' threshold (' + threshold + '%)') | ||
log.error(message) | ||
} | ||
@@ -267,6 +271,8 @@ } | ||
helper.mkdirIfNotExists(outputPath, function () { | ||
log.debug('Writing coverage to %s', outputPath) | ||
report.execute(context) | ||
}) | ||
const mkdirIfNotExists = promisify(helper.mkdirIfNotExists) | ||
await mkdirIfNotExists(outputPath) | ||
log.debug('Writing coverage to %s', outputPath) | ||
report.execute(context) | ||
return results | ||
@@ -291,12 +297,17 @@ } | ||
this.onExit = async function (done) { | ||
const results = await promiseComplete | ||
if (results && results.exitCode === 1) { | ||
done(results.exitCode) | ||
return | ||
try { | ||
const results = await promiseComplete | ||
if (results && results.exitCode === 1) { | ||
done(results.exitCode) | ||
return | ||
} | ||
if (typeof config._onExit === 'function') { | ||
config._onExit(done) | ||
} else { | ||
done() | ||
} | ||
} catch (e) { | ||
log.error('Unexpected error while generating coverage report.\n', e) | ||
done(1) | ||
} | ||
if (typeof config._onExit === 'function') { | ||
config._onExit(done) | ||
} else { | ||
done() | ||
} | ||
} | ||
@@ -303,0 +314,0 @@ } |
126
package.json
{ | ||
"name": "karma-coverage", | ||
"version": "2.0.3", | ||
"version": "2.2.0", | ||
"description": "A Karma plugin. Generate code coverage.", | ||
@@ -8,3 +8,8 @@ "main": "lib/index.js", | ||
"lint": "eslint **/*.js", | ||
"test": "grunt" | ||
"test": "mocha", | ||
"update-contributors": "grunt contributors", | ||
"examples": "grunt karma", | ||
"semantic-release": "semantic-release", | ||
"release": "npm run update-contributors && semantic-release", | ||
"commitlint": "commitlint" | ||
}, | ||
@@ -24,7 +29,7 @@ "repository": { | ||
"dependencies": { | ||
"istanbul-lib-coverage": "^3.0.0", | ||
"istanbul-lib-instrument": "^4.0.1", | ||
"istanbul-lib-coverage": "^3.2.0", | ||
"istanbul-lib-instrument": "^5.1.0", | ||
"istanbul-lib-report": "^3.0.0", | ||
"istanbul-lib-source-maps": "^4.0.0", | ||
"istanbul-reports": "^3.0.0", | ||
"istanbul-lib-source-maps": "^4.0.1", | ||
"istanbul-reports": "^3.0.5", | ||
"minimatch": "^3.0.4" | ||
@@ -34,37 +39,33 @@ }, | ||
"devDependencies": { | ||
"@commitlint/cli": "^8.3.5", | ||
"@commitlint/travis-cli": "^8.3.5", | ||
"@commitlint/config-conventional": "^8.3.4", | ||
"@semantic-release/changelog": "5.0.1", | ||
"@semantic-release/git": "9.0.0", | ||
"@semantic-release/npm": "7.0.5", | ||
"chai": "^4.2.0", | ||
"@commitlint/cli": "^8.3.6", | ||
"@commitlint/config-conventional": "^8.3.6", | ||
"@commitlint/travis-cli": "^8.3.6", | ||
"@semantic-release/changelog": "^5.0.1", | ||
"@semantic-release/git": "^9.0.0", | ||
"@semantic-release/npm": "^7.0.5", | ||
"chai": "^4.3.4", | ||
"coffeescript": "^2.6.1", | ||
"eslint": "^6.5.1", | ||
"eslint-config-standard": "^14.1.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-config-standard": "^14.1.1", | ||
"eslint-plugin-import": "^2.25.3", | ||
"eslint-plugin-node": "^10.0.0", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-standard": "^4.0.1", | ||
"grunt": "^1.0.3", | ||
"grunt-bump": "^0.8.0", | ||
"grunt-cli": "^1.3.2", | ||
"grunt-conventional-changelog": "^6.1.0", | ||
"grunt-conventional-github-releaser": "^1.0.0", | ||
"eslint-plugin-promise": "^4.3.1", | ||
"eslint-plugin-standard": "^4.1.0", | ||
"grunt": "^1.4.1", | ||
"grunt-cli": "^1.4.3", | ||
"grunt-karma": "^3.0.2", | ||
"grunt-npm": "^0.0.2", | ||
"grunt-simple-mocha": "^0.4.1", | ||
"husky": "^4.2.3", | ||
"husky": "^4.3.8", | ||
"ibrik": "^2.0.0", | ||
"karma": "^4.2.0", | ||
"karma-coffee-preprocessor": "1.x || ^0.3.0", | ||
"karma-coffee-preprocessor": "^1.0.1", | ||
"karma-firefox-launcher": "1.x || ^0.1.6", | ||
"karma-mocha": "1.x || ^0.2.0", | ||
"karma-mocha": "^2.0.1", | ||
"karma-requirejs": "1.x || ^0.2.2", | ||
"load-grunt-tasks": "^5.1.0", | ||
"mocha": "^6.0.2", | ||
"mocha": "^7.2.0", | ||
"mocks": "0.0.15", | ||
"requirejs": "^2.1.20", | ||
"semantic-release": "17.0.4", | ||
"semantic-release": "^17.0.1", | ||
"sinon": "^7.2.7", | ||
"sinon-chai": "^3.3.0" | ||
"sinon-chai": "^3.7.0" | ||
}, | ||
@@ -74,2 +75,8 @@ "engines": { | ||
}, | ||
"mocha": { | ||
"ui": "bdd", | ||
"require": [ | ||
"test/mocha-globals.js" | ||
] | ||
}, | ||
"commitlint": { | ||
@@ -89,16 +96,42 @@ "extends": [ | ||
"Aymeric Beaumet <aymeric@beaumet.me>", | ||
"Anton <anton.redfox@gmail.com>", | ||
"johnjbarton <johnjbarton@johnjbarton.com>", | ||
"dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>", | ||
"Jonathan Ginsburg <jon@than.ml>", | ||
"Mark Ethan Trostler <mark@zzo.com>", | ||
"Tim Kang <timkang@ucla.edu>", | ||
"hicom150 <hicom150@gmail.com>", | ||
"Anton Shchekota <anton.redfox@gmail.com>", | ||
"Maksim Ryzhikov <rv.maksim@gmail.com>", | ||
"Nick Malaguti <nmalaguti@palantir.com>", | ||
"Maksim Ryzhikov <rv.maksim@gmail.com>", | ||
"semantic-release-bot <semantic-release-bot@martynus.net>", | ||
"Mark Trostler <mark@zzo.com>", | ||
"nicojs <jansennico@gmail.com>", | ||
"Allen Bierbaum <abierbaum@gmail.com>", | ||
"Douglas Duteil <douglasduteil@gmail.com>", | ||
"Julen Garcia Leunda <hicom150@gmail.com>", | ||
"Matt Winchester <m_winche@yahoo.com>", | ||
"Srinivas Dhanwada <dhanwada.dev@gmail.com>", | ||
"Tanguy Krotoff <tkrotoff@gmail.com>", | ||
"Wei Kin Huang <weikin.huang04@gmail.com>", | ||
"Douglas Duteil <douglasduteil@gmail.com>", | ||
"Matt Winchester <m_winche@yahoo.com>", | ||
"Julen Garcia Leunda <hicom150@gmail.com>", | ||
"Allen Bierbaum <abierbaum@gmail.com>", | ||
"Yaroslav Admin <devoto13@gmail.com>", | ||
"Adam Heath <adam-h@users.noreply.github.com>", | ||
"Andrew Lane <AndrewLane@users.noreply.github.com>", | ||
"Chris Gladd <chris.m.gladd@gmail.com>", | ||
"Clayton Watts <cletusw@gmail.com>", | ||
"Dan Watling <dan@synaptik.com>", | ||
"Darryl Pogue <darryl@dpogue.ca>", | ||
"Diogo Nicoleti <diogo.nicoleti@gmail.com>", | ||
"Dmitry Petrov <dpetroff@gmail.com>", | ||
"Greg Varsanyi <gvarsanyi@gmail.com>", | ||
"Ian Rufus <ian.j.rufus@gmail.com>", | ||
"James Talmage <james@talmage.io>", | ||
"Joseph Connolly <joec@avinetworks.com>", | ||
"Joshua Appelman <jappelman@xebia.com>", | ||
"Julie <ju.ralph@gmail.com>", | ||
"Kyle Welsby <kyle@mekyle.com>", | ||
"Lloyd Smith II <lloyd@trove.com>", | ||
"Maciej Rzepiński <maciej.rzepinski@gmail.com>", | ||
"Marceli.no <me@marceli.no>", | ||
"Matt Lewis <matthew.lewis@socialsignin.co.uk>", | ||
"Michael Noack <michael.noack@sealink.com.au>", | ||
@@ -112,6 +145,6 @@ "Michael Stramel <m.stramel89@gmail.com>", | ||
"Sahat Yalkabov <sakhat@gmail.com>", | ||
"Srinivas Dhanwada <dhanwada.dev@gmail.com>", | ||
"Tanjo, Hiroyuki <expheno@gmail.com>", | ||
"Taylor Hakes <taylor@taylorhakes.com>", | ||
"Taylor McGann <tmcgann@users.noreply.github.com>", | ||
"Tim van der Lippe <tvanderlippe@google.com>", | ||
"Timo Tijhof <krinklemail@gmail.com>", | ||
@@ -122,2 +155,3 @@ "Tom Kirkpatrick <tom@systemseed.com>", | ||
"Yusuke Suzuki <utatane.tea@gmail.com>", | ||
"abbr <abbr@users.noreply.github.com>", | ||
"aprooks <alexander.prooks@gmail.com>", | ||
@@ -127,22 +161,4 @@ "carlos <cafesanu@gmail.com>", | ||
"piecyk <piecyk@gmail.com>", | ||
"Adam Heath <adam-h@users.noreply.github.com>", | ||
"terussell85 <terussell85@gmail.com>", | ||
"Andrew Lane <AndrewLane@users.noreply.github.com>", | ||
"Chris Gladd <chris.m.gladd@gmail.com>", | ||
"Clayton Watts <cletusw@gmail.com>", | ||
"Dan Watling <dan@synaptik.com>", | ||
"Diogo Nicoleti <diogo.nicoleti@gmail.com>", | ||
"Dmitry Petrov <dpetroff@gmail.com>", | ||
"Greg Varsanyi <gvarsanyi@gmail.com>", | ||
"Ian Rufus <ian.j.rufus@gmail.com>", | ||
"James Talmage <james@talmage.io>", | ||
"Joseph Connolly <joec@avinetworks.com>", | ||
"Joshua Appelman <jappelman@xebia.com>", | ||
"Julie <ju.ralph@gmail.com>", | ||
"Kyle Welsby <kyle@mekyle.com>", | ||
"Lloyd Smith II <lloyd@trove.com>", | ||
"Maciej Rzepiński <maciej.rzepinski@gmail.com>", | ||
"Marceli.no <me@marceli.no>", | ||
"Matt Lewis <matthew.lewis@socialsignin.co.uk>" | ||
"terussell85 <terussell85@gmail.com>" | ||
] | ||
} |
@@ -121,3 +121,3 @@ # karma-coverage | ||
[homepage]: http://karma-runner.github.com | ||
[homepage]: https://karma-runner.github.io | ||
[Istanbul]: https://istanbul.js.org |
@@ -20,3 +20,6 @@ module.exports = { | ||
'@semantic-release/github' | ||
], | ||
fail: [ | ||
'@semantic-release/github' | ||
] | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
59900
31
0
566
+ Addedistanbul-lib-instrument@5.2.1(transitive)
- Removedistanbul-lib-instrument@4.0.3(transitive)
Updatedistanbul-lib-coverage@^3.2.0
Updatedistanbul-reports@^3.0.5