Skip to content

Commit

Permalink
replace karma-coverage-istanbul-reporter with karma-coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Fawke committed Feb 25, 2020
1 parent ac0ce27 commit 222ecdf
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 42 deletions.
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function viewCoverage(done) {

connect.server({
port: coveragePort,
root: 'build/coverage/karma_html',
root: 'build/coverage/karma-html',
livereload: false
});
opens('http://' + mylocalhost + ':' + coveragePort);
Expand Down
29 changes: 12 additions & 17 deletions karma.conf.maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function newWebpackConfig(codeCoverage) {
function newPluginsArray(browserstack) {
var plugins = [
'karma-chrome-launcher',
'karma-coverage-istanbul-reporter',
'karma-coverage',
'karma-es5-shim',
'karma-mocha',
'karma-chai',
Expand All @@ -54,7 +54,7 @@ function newPluginsArray(browserstack) {
return plugins;
}

function setReporters(karmaConf, codeCoverage, browserstack) {
function setReporters(karmaConf, browserstack) {
// In browserstack, the default 'progress' reporter floods the logs.
// The karma-spec-reporter reports failures more concisely
if (browserstack) {
Expand All @@ -66,19 +66,6 @@ function setReporters(karmaConf, codeCoverage, browserstack) {
suppressPassed: true
};
}
if (codeCoverage) {
karmaConf.reporters.push('coverage-istanbul');
karmaConf.coverageIstanbulReporter = {
reports: ['html', 'lcovonly', 'text-summary'],
dir: path.join(__dirname, 'build', 'coverage'),
'report-config': {
html: {
subdir: 'karma_html',
urlFriendlyName: true, // simply replaces spaces with _ for files/dirs
}
}
}
}
}

function setBrowsers(karmaConf, browserstack) {
Expand Down Expand Up @@ -156,12 +143,20 @@ module.exports = function(codeCoverage, browserstack, watchMode, file) {
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,

reporters: ['mocha'],
reporters: ['mocha', 'coverage'],

mochaReporter: {
showDiff: true,
output: 'minimal'
},

coverageReporter: {
dir: 'build/coverage',
reporters: [
{ type: 'html', subdir: 'karma-html' }
]
},

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: !watchMode,
Expand All @@ -172,7 +167,7 @@ module.exports = function(codeCoverage, browserstack, watchMode, file) {

plugins: plugins
}
setReporters(config, codeCoverage, browserstack);
setReporters(config, browserstack);
setBrowsers(config, browserstack);
return config;
}
73 changes: 55 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
"node": ">=8.9.0"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.3",
"@babel/core": "^7.8.4",
"@babel/preset-env": "^7.8.4",
"ajv": "5.5.2",
"babel-loader": "^8.0.5",
"chai": "^4.2.0",
"coveralls": "^3.0.2",
"documentation": "^5.2.2",
"es5-shim": "^4.5.2",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-node": "^5.1.0",
"eslint-plugin-prebid": "file:./plugins/eslint",
"eslint-plugin-promise": "^3.5.0",
Expand Down Expand Up @@ -63,9 +63,10 @@
"karma-browserstack-launcher": "^1.3.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^2.0.1",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-es5-shim": "^0.0.4",
"karma-firefox-launcher": "^1.0.1",
"karma-firefox-launcher": "^1.3.0",
"karma-ie-launcher": "^1.0.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
Expand Down Expand Up @@ -97,12 +98,12 @@
"babel-plugin-transform-object-assign": "^6.22.0",
"core-js": "^2.4.1",
"criteo-direct-rsa-validate": "^1.1.0",
"crypto-js": "^3.1.9-1",
"crypto-js": "^3.3.0",
"deep-equal": "^1.0.1",
"dlv": "1.1.3",
"dset": "2.0.1",
"express": "^4.15.4",
"fun-hooks": "^0.9.5",
"fun-hooks": "^0.9.8",
"jsencrypt": "^3.0.0-rc.1",
"just-clone": "^1.0.2"
}
Expand Down

0 comments on commit 222ecdf

Please sign in to comment.