Skip to content

fix: move injectClient and injectHot under client property #3104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 20 additions & 22 deletions lib/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,26 @@
}
}
]
},
"needClientEntry": {
"anyOf": [
{
"type": "boolean"
},
{
"instanceof": "Function"
}
]
},
"needHotEntry": {
"anyOf": [
{
"type": "boolean"
},
{
"instanceof": "Function"
}
]
}
},
"additionalProperties": false
Expand Down Expand Up @@ -223,26 +243,6 @@
}
]
},
"injectClient": {
"anyOf": [
{
"type": "boolean"
},
{
"instanceof": "Function"
}
]
},
"injectHot": {
"anyOf": [
{
"type": "boolean"
},
{
"instanceof": "Function"
}
]
},
"liveReload": {
"type": "boolean"
},
Expand Down Expand Up @@ -395,8 +395,6 @@
"hot": "should be {Boolean|String} (https://webpack.js.org/configuration/dev-server/#devserverhot)",
"http2": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverhttp2)",
"https": "should be {Object|Boolean} (https://webpack.js.org/configuration/dev-server/#devserverhttps)",
"injectClient": "should be {Boolean|Function} (https://webpack.js.org/configuration/dev-server/#devserverinjectclient)",
"injectHot": "should be {Boolean|Function} (https://webpack.js.org/configuration/dev-server/#devserverinjecthot)",
"liveReload": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverlivereload)",
"onAfterSetupMiddleware": "should be {Function} (https://webpack.js.org/configuration/dev-server/#devserverafter)",
"onBeforeSetupMiddleware": "should be {Function} (https://webpack.js.org/configuration/dev-server/#devserverbefore)",
Expand Down
9 changes: 3 additions & 6 deletions test/__snapshots__/Validation.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ exports[`Validation validation should fail validation for invalid \`hot\` config

exports[`Validation validation should fail validation for invalid \`injectHot\` configuration 1`] = `
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
- configuration.injectHot should be one of these:
boolean | function
Details:
* configuration.injectHot should be a boolean.
* configuration.injectHot should be an instance of function."
- configuration has an unknown property 'injectHot'. These properties are valid:
object { bonjour?, client?, compress?, dev?, firewall?, headers?, historyApiFallback?, host?, hot?, http2?, https?, liveReload?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, openPage?, port?, proxy?, public?, setupExitSignals?, static?, stdin?, transportMode?, useLocalIp? }"
`;

exports[`Validation validation should fail validation for invalid \`static\` configuration 1`] = `
Expand All @@ -34,5 +31,5 @@ exports[`Validation validation should fail validation for invalid \`static\` con
exports[`Validation validation should fail validation for no additional properties 1`] = `
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
- configuration has an unknown property 'additional'. These properties are valid:
object { bonjour?, client?, compress?, dev?, firewall?, headers?, historyApiFallback?, host?, hot?, http2?, https?, injectClient?, injectHot?, liveReload?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, openPage?, port?, proxy?, public?, setupExitSignals?, static?, stdin?, transportMode?, useLocalIp? }"
object { bonjour?, client?, compress?, dev?, firewall?, headers?, historyApiFallback?, host?, hot?, http2?, https?, liveReload?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, openPage?, port?, proxy?, public?, setupExitSignals?, static?, stdin?, transportMode?, useLocalIp? }"
`;
29 changes: 20 additions & 9 deletions test/options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ describe('options', () => {
if (typeof opts.static === 'undefined') {
opts.static = false;
}

server = new Server(compiler, opts);
})
.then(() => {
Expand Down Expand Up @@ -239,6 +238,16 @@ describe('options', () => {
},
},
},
{
client: {
needClientEntry: true,
},
},
{
client: {
needHotEntry: true,
},
},
],
failure: [
'whoops!',
Expand Down Expand Up @@ -288,6 +297,16 @@ describe('options', () => {
},
},
},
{
client: {
needClientEntry: [''],
},
},
{
client: {
needHotEntry: [''],
},
},
],
},
compress: {
Expand Down Expand Up @@ -358,14 +377,6 @@ describe('options', () => {
},
],
},
injectClient: {
success: [true, () => {}],
failure: [''],
},
injectHot: {
success: [true, () => {}],
failure: [''],
},
onListening: {
success: [() => {}],
failure: [''],
Expand Down