diff --git a/lib/options.json b/lib/options.json index 5edd121159..a845f19eab 100644 --- a/lib/options.json +++ b/lib/options.json @@ -104,6 +104,26 @@ } } ] + }, + "needClientEntry": { + "anyOf": [ + { + "type": "boolean" + }, + { + "instanceof": "Function" + } + ] + }, + "needHotEntry": { + "anyOf": [ + { + "type": "boolean" + }, + { + "instanceof": "Function" + } + ] } }, "additionalProperties": false @@ -223,26 +243,6 @@ } ] }, - "injectClient": { - "anyOf": [ - { - "type": "boolean" - }, - { - "instanceof": "Function" - } - ] - }, - "injectHot": { - "anyOf": [ - { - "type": "boolean" - }, - { - "instanceof": "Function" - } - ] - }, "liveReload": { "type": "boolean" }, @@ -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)", diff --git a/test/__snapshots__/Validation.test.js.snap b/test/__snapshots__/Validation.test.js.snap index f88f0c5255..98a6ae0074 100644 --- a/test/__snapshots__/Validation.test.js.snap +++ b/test/__snapshots__/Validation.test.js.snap @@ -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`] = ` @@ -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? }" `; diff --git a/test/options.test.js b/test/options.test.js index 95dccc82e0..0139db3d2f 100644 --- a/test/options.test.js +++ b/test/options.test.js @@ -76,7 +76,6 @@ describe('options', () => { if (typeof opts.static === 'undefined') { opts.static = false; } - server = new Server(compiler, opts); }) .then(() => { @@ -239,6 +238,16 @@ describe('options', () => { }, }, }, + { + client: { + needClientEntry: true, + }, + }, + { + client: { + needHotEntry: true, + }, + }, ], failure: [ 'whoops!', @@ -288,6 +297,16 @@ describe('options', () => { }, }, }, + { + client: { + needClientEntry: [''], + }, + }, + { + client: { + needHotEntry: [''], + }, + }, ], }, compress: { @@ -358,14 +377,6 @@ describe('options', () => { }, ], }, - injectClient: { - success: [true, () => {}], - failure: [''], - }, - injectHot: { - success: [true, () => {}], - failure: [''], - }, onListening: { success: [() => {}], failure: [''],