Skip to content

Commit e63d643

Browse files
committed
fix: add properties
1 parent 699d0a9 commit e63d643

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

lib/options.json

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,34 @@
145145
"type": "boolean"
146146
},
147147
{
148-
"type": "object"
148+
"type": "object",
149+
"properties": {
150+
"name": {
151+
"type": "string"
152+
},
153+
"host": {
154+
"type": "string"
155+
},
156+
"port": {
157+
"type": "number"
158+
},
159+
"type": {
160+
"type": "string"
161+
},
162+
"protocol": {
163+
"type": "string"
164+
},
165+
"subTypes": {
166+
"type": "array",
167+
"items": {
168+
"type": "string"
169+
}
170+
},
171+
"txt": {
172+
"type": "object"
173+
}
174+
},
175+
"additionalProperties": false
149176
}
150177
],
151178
"description": "Broadcasts the server via ZeroConf networking on start. https://webpack.js.org/configuration/dev-server/#devserverbonjour"

test/__snapshots__/validate-options.test.js.snap.webpack4

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33
exports[`options validate should throw an error on the "bonjour" option with '' value 1`] = `
44
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
55
- configuration.bonjour should be one of these:
6-
boolean | object { }
6+
boolean | object { name?, host?, port?, type?, subTypes?, txt? }
77
-> Broadcasts the server via ZeroConf networking on start. https://webpack.js.org/configuration/dev-server/#devserverbonjour
88
Details:
99
* configuration.bonjour should be a boolean.
1010
* configuration.bonjour should be an object:
11-
object { … }"
11+
object { name?, host?, port?, type?, subTypes?, txt? }"
12+
`;
13+
14+
exports[`options validate should throw an error on the "bonjour" option with '{"test":"chuntaro"}' value 1`] = `
15+
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
16+
- configuration.bonjour has an unknown property 'test'. These properties are valid:
17+
object { name?, host?, port?, type?, subTypes?, txt? }"
1218
`;
1319

1420
exports[`options validate should throw an error on the "client" option with '{"host":true,"path":"","port":8080}' value 1`] = `

test/__snapshots__/validate-options.test.js.snap.webpack5

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33
exports[`options validate should throw an error on the "bonjour" option with '' value 1`] = `
44
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
55
- configuration.bonjour should be one of these:
6-
boolean | object { }
6+
boolean | object { name?, host?, port?, type?, subTypes?, txt? }
77
-> Broadcasts the server via ZeroConf networking on start. https://webpack.js.org/configuration/dev-server/#devserverbonjour
88
Details:
99
* configuration.bonjour should be a boolean.
1010
* configuration.bonjour should be an object:
11-
object { … }"
11+
object { name?, host?, port?, type?, subTypes?, txt? }"
12+
`;
13+
14+
exports[`options validate should throw an error on the "bonjour" option with '{"test":"chuntaro"}' value 1`] = `
15+
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
16+
- configuration.bonjour has an unknown property 'test'. These properties are valid:
17+
object { name?, host?, port?, type?, subTypes?, txt? }"
1218
`;
1319

1420
exports[`options validate should throw an error on the "client" option with '{"host":true,"path":"","port":8080}' value 1`] = `

test/validate-options.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const tests = {
2424
},
2525
bonjour: {
2626
success: [false, true, { type: 'https' }],
27-
failure: [''],
27+
failure: ['', { test: 'chuntaro' }],
2828
},
2929
client: {
3030
success: [

0 commit comments

Comments
 (0)