Skip to content

Commit

Permalink
Merge pull request #9306 from jamesgeorge007/hotfix/refactor
Browse files Browse the repository at this point in the history
Handle cryptic error message being thrown
  • Loading branch information
sokra committed Jun 19, 2019
2 parents efb250d + 226e8ce commit 494e16b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/webpack.js
Expand Up @@ -32,7 +32,9 @@ const webpack = (options, callback) => {
}
let compiler;
if (Array.isArray(options)) {
compiler = new MultiCompiler(options.map(options => webpack(options)));
compiler = new MultiCompiler(
Array.from(options).map(options => webpack(options))
);
} else if (typeof options === "object") {
options = new WebpackOptionsDefaulter().process(options);

Expand Down
19 changes: 19 additions & 0 deletions test/Validation.test.js
Expand Up @@ -404,6 +404,25 @@ describe("Validation", () => {
- configuration.mode should be one of these:
\\"development\\" | \\"production\\" | \\"none\\"
-> Enable production optimizations or development hints."
`)
);

createTestCase(
"holey array",
// eslint-disable-next-line no-sparse-arrays
[
{
mode: "production"
},
,
{
mode: "development"
}
],
msg =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration should be an object."
`)
);
});

0 comments on commit 494e16b

Please sign in to comment.