Skip to content

Commit

Permalink
fix(options): improved ValidationError messages
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-ciniawsky committed Aug 8, 2018
1 parent fbf05de commit 549ea08
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
18 changes: 18 additions & 0 deletions src/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
"type": "object"
}
},
"errorMessage": {
"properties": {
"ctx": "should be {Object} (https://github.com/postcss/postcss-loader#context-ctx)",
"path": "should be {String} (https://github.com/postcss/postcss-loader#path)"
}
},
"additionalProperties": false
},
"exec": {
Expand Down Expand Up @@ -39,5 +45,17 @@
"type": [ "string", "boolean" ]
}
},
"errorMessage": {
"properties": {
"exec": "should be {Boolean} (https://github.com/postcss/postcss-loader#exec)",
"ident": "should be {String} (https://github.com/postcss/postcss-loader#plugins)",
"config": "should be {Object} (https://github.com/postcss/postcss-loader#config)",
"parser": "should be {String|Object} (https://github.com/postcss/postcss-loader#parser)",
"syntax": "should be {String|Object} (https://github.com/postcss/postcss-loader#syntax)",
"stringifier": "should be {String|Object} (https://github.com/postcss/postcss-loader#stringifier)",
"plugins": "should be {Array|Object|Function} (https://github.com/postcss/postcss-loader#plugins)",
"sourceMap": "should be {String|Boolean} (https://github.com/postcss/postcss-loader#sourcemap)"
}
},
"additionalProperties": true
}
8 changes: 5 additions & 3 deletions test/__snapshots__/Errors.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Errors Syntax Error 1`] = `
"Syntax Error
"Syntax Error
(1:3) Unexpected separator in property
Expand All @@ -14,6 +14,8 @@ exports[`Errors Syntax Error 1`] = `
exports[`Errors Validation Error 1`] = `
"ValidationError: PostCSS Loader Invalid Options
options.sourceMap should be string,boolean
"
options.sourceMap should be {String|Boolean} (https://github.com/postcss/postcss-loader#sourcemap)
at validateOptions (/Users/Cini/Github/webpack/loaders/postcss/node_modules/@webpack-utilities/schema/src/validateOptions.js:25:11)
at Object.loader (/Users/Cini/Github/webpack/loaders/postcss/src/index.js:44:3)"
`;

0 comments on commit 549ea08

Please sign in to comment.