Skip to content

Commit 384d459

Browse files
JSMikeMichael Cebrian
authored and
Michael Cebrian
committed
fix(karma): set defaults for karma.conf.js
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.
1 parent c935039 commit 384d459

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/angular-cli/plugins/karma.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ const init = (config) => {
1212
const environment = config.angularCli.environment || 'dev';
1313

1414
// add webpack config
15-
config.webpack = getWebpackTestConfig(config.basePath, environment, appConfig);
16-
config.webpackMiddleware = {
15+
const webpackConfig = getWebpackTestConfig(config.basePath, environment, appConfig);
16+
const webpackMiddlewareConfig = {
1717
noInfo: true, // Hide webpack output because its noisy.
1818
stats: { // Also prevent chunk and module display output, cleaner look. Only emit errors.
1919
assets: false,
@@ -25,6 +25,8 @@ const init = (config) => {
2525
chunkModules: false
2626
}
2727
};
28+
config.webpack = Object.assign(webpackConfig, config.webpack);
29+
config.webpackMiddleware = Object.assign(webpackMiddlewareConfig, config.webpackMiddleware);
2830

2931
// replace the angular-cli preprocessor with webpack+sourcemap
3032
Object.keys(config.preprocessors)

0 commit comments

Comments
 (0)