summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorSimon Knox <psimyn@gmail.com>2018-10-02 13:09:43 +1000
committerSimon Knox <psimyn@gmail.com>2018-10-02 13:47:26 +1000
commit6a63546fbcf196f2968e9c8f5db42ce5863ddd9b (patch)
treec1b32c7b3fc0c684be2307d1474ee8269293c1fb /config
parent0ef1060e14b8ac09159e466fe5f4ca3195e080c2 (diff)
downloadgitlab-ce-6a63546fbcf196f2968e9c8f5db42ce5863ddd9b.tar.gz
Speed up karma runs for development
Using DefinePlugin means the block wrapped in GENERATE_COVERAGE_REPORT gets eliminated. Previously it was always included (with the entire app!), even if using -f option
Diffstat (limited to 'config')
-rw-r--r--config/karma.config.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/config/karma.config.js b/config/karma.config.js
index 74dc5c13c70..cad3c0e9193 100644
--- a/config/karma.config.js
+++ b/config/karma.config.js
@@ -6,6 +6,7 @@ const argumentsParser = require('commander');
const webpackConfig = require('./webpack.config.js');
const ROOT_PATH = path.resolve(__dirname, '..');
+const GENERATE_COVERAGE_REPORT = process.env.BABEL_ENV === 'coverage' || process.env.NODE_ENV === 'coverage';
function fatalError(message) {
console.error(chalk.red(`\nError: ${message}\n`));
@@ -22,6 +23,10 @@ webpackConfig.optimization.splitChunks = false;
// use quicker sourcemap option
webpackConfig.devtool = 'cheap-inline-source-map';
+webpackConfig.plugins.push(
+ new webpack.DefinePlugin({ GENERATE_COVERAGE_REPORT }),
+);
+
const specFilters = argumentsParser
.option(
'-f, --filter-spec [filter]',
@@ -118,7 +123,7 @@ module.exports = function(config) {
};
}
- if (process.env.BABEL_ENV === 'coverage' || process.env.NODE_ENV === 'coverage') {
+ if (GENERATE_COVERAGE_REPORT) {
karmaConfig.reporters.push('coverage-istanbul');
karmaConfig.coverageIstanbulReporter = {
reports: ['html', 'text-summary'],