Skip to content

Commit 914c4a7

Browse files
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 8766494 commit 914c4a7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

plugins/karma.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ const init = (config) => {
99
const appConfig = angularCliConfig.apps[0];
1010

1111
// add webpack config
12-
config.webpack = getWebpackTestConfig(config.basePath, appConfig);
13-
config.webpackMiddleware = {
12+
const webpackMiddlewareConfig = {
1413
noInfo: true, // Hide webpack output because its noisy.
1514
stats: { // Also prevent chunk and module display output, cleaner look. Only emit errors.
1615
assets: false,
@@ -22,6 +21,8 @@ const init = (config) => {
2221
chunkModules: false
2322
}
2423
};
24+
config.webpack = Object.assign(getWebpackTestConfig(config.basePath, appConfig), config.webpack);
25+
config.webpackMiddleware = Object.assign(webpackMiddlewareConfig, config.webpackMiddleware);
2526

2627
// replace the angular-cli preprocessor with webpack+sourcemap
2728
Object.keys(config.preprocessors)
@@ -40,4 +41,4 @@ preprocessor.$inject = []
4041
module.exports = Object.assign({
4142
'framework:angular-cli': ['factory', init],
4243
'preprocessor:angular-cli': ['factory', preprocessor]
43-
}, require('karma-webpack'), require('karma-sourcemap-loader'));
44+
}, require('karma-webpack'), require('karma-sourcemap-loader'));

0 commit comments

Comments
 (0)