Skip to content

Commit 16eca47

Browse files
bebrawjonathanglasmeyer
authored andcommitted
feat(webpack-dev-server): Support stats presets
Webpack defines a few stats presets accessible through a string. Better allow those. See https://github.com/webpack/webpack/blob/5b5775f9e2fc73fea46629f2d6a3ed7a1f8424d3/lib/Stats.js#L696-L730 and webpack/webpack#1191 for further information.
1 parent 724639d commit 16eca47

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/properties/devServer/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ export default Joi.object({
2828
filename: notAbsolutePath,
2929
watchOptions: watchOptionsSchema,
3030
hot: Joi.boolean(),
31-
stats: Joi.object(),
31+
stats: Joi.alternatives().try([
32+
Joi.object(),
33+
Joi.string().valid(['none', 'errors-only', 'minimal', 'normal', 'verbose']),
34+
]),
3235
noInfo: Joi.boolean(),
3336
proxy: [
3437
Joi.object(),

src/properties/devServer/index.test.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,26 @@ const validModuleConfigs = [
5454
// #24
5555
{ stats: {} },
5656
// #25
57-
{ noInfo: true },
57+
{ stats: 'none' },
5858
// #26
59-
{ proxy: {} },
59+
{ stats: 'errors-only' },
6060
// #27
61-
{ proxy: 'http://proxy.url/' },
61+
{ stats: 'minimal' },
6262
// #28
63-
{ proxy: [] },
63+
{ stats: 'normal' },
6464
// #29
65-
{ staticOptions: {} },
65+
{ stats: 'verbose' },
6666
// #30
67+
{ noInfo: true },
68+
// #31
69+
{ proxy: {} },
70+
// #32
71+
{ proxy: 'http://proxy.url/' },
72+
// #33
73+
{ proxy: [] },
74+
// #34
75+
{ staticOptions: {} },
76+
// #35
6777
{ headers: {} },
6878
]
6979

@@ -77,6 +87,8 @@ const invalidModuleConfigs = [
7787
// #3
7888
{ input: { stats: true } },
7989
// #4
90+
{ input: { stats: 'foobar' } },
91+
// #5
8092
{ input: { proxy: true } },
8193
]
8294

0 commit comments

Comments
 (0)