Merge pull request #5825 from jbottigliero/fix-webpackOptionsSchema

[fix] webpackOptionsSchema
This commit is contained in:
Tobias Koppers 2017-10-16 15:12:02 +02:00 committed by GitHub
commit 5433b8cc78
4 changed files with 75 additions and 2 deletions

View File

@ -975,6 +975,7 @@
"anyOf": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"context": {
"type": "string",
@ -997,6 +998,46 @@
"type": "boolean",
"description": "add assets information"
},
"env": {
"type": "boolean",
"description": "add --env information"
},
"colors": {
"oneOf": [
{
"type": "boolean",
"description": "`webpack --colors` equivalent"
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"bold": {
"type": "string"
},
"red": {
"type": "string"
},
"green": {
"type": "string"
},
"cyan": {
"type": "string"
},
"magenta": {
"type": "string"
},
"yellow": {
"type": "string"
}
}
}
]
},
"maxModules": {
"type": "number",
"description": "Set the maximum number of modules to be shown"
},
"chunks": {
"type": "boolean",
"description": "add chunk information"
@ -1017,6 +1058,10 @@
"type": "boolean",
"description": "add also information about cached (not built) modules"
},
"cachedAssets": {
"type": "boolean",
"description": "Show cached assets (setting this to `false` only shows emitted files)"
},
"reasons": {
"type": "boolean",
"description": "add information about the reasons why modules are included"
@ -1041,6 +1086,10 @@
"description": "Please use excludeModules instead.",
"$ref": "#/definitions/filter-types"
},
"entrypoints": {
"type": "boolean",
"description": "Display the entry points with the corresponding bundles"
},
"errorDetails": {
"type": "boolean",
"description": "add details to errors (like resolving log)"
@ -1065,6 +1114,10 @@
"type": "string",
"description": "sort the assets by that field"
},
"publicPath": {
"type": "boolean",
"description": "Add public path information"
},
"providedExports": {
"type": "boolean",
"description": "show exports provided by modules"

View File

@ -199,6 +199,20 @@ describe("Validation", () => {
message: [
" - configuration.context: The provided value \"baz\" is not an absolute path!",
]
}, {
name: "missing stats option",
config: {
entry: "foo.js",
stats: {
foobar: true
}
},
test(e) {
e.message.should.startWith("Invalid configuration object.");
e.message.split("\n").slice(1)[0].should.be.eql(
" - configuration.stats should be one of these:"
);
}
}];
testCases.forEach((testCase) => {
it("should fail validation for " + testCase.name, () => {
@ -207,6 +221,12 @@ describe("Validation", () => {
} catch(e) {
if(!(e instanceof WebpackOptionsValidationError))
throw e;
if(testCase.test) {
testCase.test(e);
return;
}
e.message.should.startWith("Invalid configuration object.");
e.message.split("\n").slice(1).should.be.eql(testCase.message);
return;

View File

@ -9,7 +9,7 @@ module.exports = {
},
stats: {
hash: false,
timing: false,
timings: true,
chunks: true,
chunkModules: true,
modules: false

View File

@ -9,7 +9,7 @@ module.exports = {
},
stats: {
hash: false,
timing: false,
timings: true,
chunks: true,
chunkModules: true,
modules: false