Ho trovato una soluzione a questo che non comporta la perdita di dati di copertura!
Sulla base di questa guida per Debugging Karma Unit Tests, mi si avvicinò con la seguente, che funziona in IntelliJ:
var sourcePreprocessors = 'coverage';
var isDebugMode = function() {
return process.argv.some(function (argument) {
return argument === '--debug';
});
};
var hasNoCoverage = function() {
return !(process.argv.some(function (argument) {
return argument.includes("coverage");
}));
};
if (isDebugMode() || hasNoCoverage()) {
console.log("Not generating coverage.");
sourcePreprocessors = '';
}
config.set({
...
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"WebRoot/js/**/*.js": sourcePreprocessors
},
...
});
NOTA:
Per info menzionato here, aggiungendo quanto segue al il tuo karma.conf.js
(o comunque stai configurando Karma) dovrebbe disabilitare la minifrazione:
coverageReporter: {
instrumenterOptions: {
istanbul: { noCompact: true }
}
}
Tuttavia, questo non elimina i dati di copertura, ed i file di origine ancora finiscono per essere maciullato up:
__cov_SNsw2QFfQtMZHyIEO9CT1A.s['74']++;
my.toPercentageString = function (value) {
__cov_SNsw2QFfQtMZHyIEO9CT1A.f['18']++;
__cov_SNsw2QFfQtMZHyIEO9CT1A.s['75']++;
return numbro(value).format('0.0%');
};
__cov_SNsw2QFfQtMZHyIEO9CT1A.s['76']++;
collegamento alla guida karma è rotto, e ora chiede di acquistare il dominio –
grazie per averlo indicato, risolto. – mikhail