Skip to content

Commit 8a3f0d8

Browse files
authored
test: add validation test for liveReload option (#3718)
1 parent f563d1d commit 8a3f0d8

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,13 @@ exports[`options validate should throw an error on the "ipc" option with 'false'
432432
* options.ipc should be true."
433433
`;
434434

435+
exports[`options validate should throw an error on the "liveReload" option with 'invalid' value 1`] = `
436+
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
437+
- options.liveReload should be a boolean.
438+
-> Enables reload/refresh the page(s) when file changes are detected (enabled by default).
439+
-> Read more at https://webpack.js.org/configuration/dev-server/#devserverlivereload"
440+
`;
441+
435442
exports[`options validate should throw an error on the "onAfterSetupMiddleware" option with 'false' value 1`] = `
436443
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
437444
- options.onAfterSetupMiddleware should be an instance of function.

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,13 @@ exports[`options validate should throw an error on the "ipc" option with 'false'
432432
* options.ipc should be true."
433433
`;
434434

435+
exports[`options validate should throw an error on the "liveReload" option with 'invalid' value 1`] = `
436+
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
437+
- options.liveReload should be a boolean.
438+
-> Enables reload/refresh the page(s) when file changes are detected (enabled by default).
439+
-> Read more at https://webpack.js.org/configuration/dev-server/#devserverlivereload"
440+
`;
441+
435442
exports[`options validate should throw an error on the "onAfterSetupMiddleware" option with 'false' value 1`] = `
436443
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
437444
- options.onAfterSetupMiddleware should be an instance of function.

test/validate-options.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ const tests = {
237237
success: [true, path.resolve(os.tmpdir(), "webpack-dev-server.socket")],
238238
failure: [false, {}],
239239
},
240+
liveReload: {
241+
success: [true, false],
242+
failure: ["invalid"],
243+
},
240244
onListening: {
241245
success: [() => {}],
242246
failure: [""],

0 commit comments

Comments
 (0)