From e2e94a5d70a670f77d98f1dfc197b411d3e470b4 Mon Sep 17 00:00:00 2001 From: Mike Cebrian Date: Tue, 20 Sep 2016 21:50:24 -0400 Subject: [PATCH] fix(karma): set defaults for karma.conf.js (#1837) The karma plugin is currently overwriting configuration set in karma.conf.js instead of merging existing values. This fix will set defaults but not overwrite existing configuration. --- packages/angular-cli/plugins/karma.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/angular-cli/plugins/karma.js b/packages/angular-cli/plugins/karma.js index cfd414212116..1c17e28e3771 100644 --- a/packages/angular-cli/plugins/karma.js +++ b/packages/angular-cli/plugins/karma.js @@ -12,8 +12,8 @@ const init = (config) => { const environment = config.angularCli.environment || 'dev'; // add webpack config - config.webpack = getWebpackTestConfig(config.basePath, environment, appConfig); - config.webpackMiddleware = { + const webpackConfig = getWebpackTestConfig(config.basePath, environment, appConfig); + const webpackMiddlewareConfig = { noInfo: true, // Hide webpack output because its noisy. stats: { // Also prevent chunk and module display output, cleaner look. Only emit errors. assets: false, @@ -25,6 +25,8 @@ const init = (config) => { chunkModules: false } }; + config.webpack = Object.assign(webpackConfig, config.webpack); + config.webpackMiddleware = Object.assign(webpackMiddlewareConfig, config.webpackMiddleware); // replace the angular-cli preprocessor with webpack+sourcemap Object.keys(config.preprocessors)