Closed jakub-g closed 3 years ago
Good catch! Feel free to make a pull request if you have time!
Yep I'm working on it :)
Unsure if this is related, however I'm getting the same error when using a multi-compiler config, but I'm on webpack-karma version 3.0.5. The error I get is:
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration has an unknown property '9'.
My Karma configuration is as follows:
{
frameworks: ['mocha'],
reporters: ['mocha'],
files: [
{ pattern: './tests/index.js' }
],
preprocessors: {
'tests/**/*.js': ['webpack', 'sourcemap']
},
webpack: webpackMerge(webpackConfig({ development: true }), {
entry: null,
output: null,
devtool: 'inline-source-map',
resolve: {}
})
}
My webpack config is a little large (first time using it), but it builds fine.
On a side note, feel free to ignore this but I haven't found anything on the subject, but is there a way to disable security policies on browsers that Karma tests on? I need to run tests that use the Audio
element, but of course the browser makers thought it "wise" to block playback until user interaction.
Closing as this seems to have been fixed with https://github.com/ryanclark/karma-webpack/commit/63cfd78c4f3d850b94b3703bcf5b4571a7f0b513
In #364
_.clone
was replaced withObject.assign
.This change assumed that
webpackOptions
is always an object, but in fact, it can be an array (multi-compiler mode, see https://github.com/webpack/webpack/tree/master/examples/multi-compiler).So after this change, an array
[ objA, objB ]
becomes an object{ 0: objA, 1: objB }
and then some subsequent logic gets changed, but also the subsequentwebpack(...)
call checks the passed config and throws an error:I propose to rollback this change then. But instead of using
lodash
we could uselodash.clone
: https://www.npmjs.com/package/lodash.clone as it's the only lodash method used.