Don't preprocess files on debug run

This commit is contained in:
Bartek Fabiszewski 2019-11-16 22:13:25 +01:00
parent 97bf833746
commit b2770120a2

View File

@ -1,8 +1,16 @@
/* eslint-disable no-undef,no-process-env */ /* eslint-disable no-undef,no-process-env,no-underscore-dangle */
// noinspection NpmUsedModulesInstalled // noinspection NpmUsedModulesInstalled
process = require('process'); process = require('process');
process.env.CHROME_BIN = require('puppeteer').executablePath(); process.env.CHROME_BIN = require('puppeteer').executablePath();
const preprocessors = {};
const reporters = [ 'progress' ];
// don't preprocess files on debug run
if (!process.env._INTELLIJ_KARMA_INTERNAL_PARAMETER_debug && !process.argv.includes('--debug')) {
preprocessors['src/*.js'] = 'karma-coverage-istanbul-instrumenter';
reporters.push('coverage-istanbul');
}
module.exports = function(config) { module.exports = function(config) {
config.set({ config.set({
basePath: 'js/', basePath: 'js/',
@ -16,15 +24,13 @@ module.exports = function(config) {
// list of files / patterns to exclude // list of files / patterns to exclude
exclude: [], exclude: [],
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: { preprocessors: preprocessors,
'src/*.js': [ 'karma-coverage-istanbul-instrumenter' ]
},
coverageIstanbulInstrumenter: { coverageIstanbulInstrumenter: {
esModules: true esModules: true
}, },
// possible values: 'dots', 'progress' // possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter // available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: [ 'progress', 'coverage-istanbul' ], reporters: reporters,
// web server port // web server port
port: 9876, port: 9876,
// enable / disable colors in the output (reporters and logs) // enable / disable colors in the output (reporters and logs)