From aa9c621525f27c5692313700d6bafae591256fb8 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Sun, 16 Jan 2022 18:17:26 +0530 Subject: [PATCH] test: move away from `magicHTML` in favor of `HTMLGeneratorPlugin` --- .../allowed-hosts.test.js.snap.webpack4 | 6 -- .../allowed-hosts.test.js.snap.webpack5 | 6 -- .../bonjour.test.js.snap.webpack4 | 54 ++++++++++++-- .../bonjour.test.js.snap.webpack5 | 54 ++++++++++++-- .../built-in-routes.test.js.snap.webpack4 | 2 + .../built-in-routes.test.js.snap.webpack5 | 2 + .../headers.test.js.snap.webpack4 | 63 ++++++++++++++-- .../headers.test.js.snap.webpack5 | 63 ++++++++++++++-- .../overlay.test.js.snap.webpack4 | 47 ++++++++++++ .../overlay.test.js.snap.webpack5 | 47 ++++++++++++ test/e2e/allowed-hosts.test.js | 2 +- test/e2e/bonjour.test.js | 12 +-- test/e2e/client-reconnect.test.js | 6 +- test/e2e/entry.test.js | 12 +-- test/e2e/headers.test.js | 16 ++-- test/e2e/host.test.js | 6 +- test/e2e/ipc.test.js | 6 +- test/e2e/multi-compiler.test.js | 2 +- test/e2e/overlay.test.js | 42 +++++------ test/e2e/port.test.js | 2 +- test/e2e/progress.test.js | 2 +- test/e2e/setup-exit-signals.test.js | 2 +- test/e2e/target.test.js | 2 +- test/e2e/web-socket-communication.test.js | 6 +- test/e2e/web-socket-server-url.test.js | 70 +++++++++--------- test/e2e/web-socket-server.test.js | 2 +- test/fixtures/client-config/webpack.config.js | 51 +------------ .../webpack.config.js | 2 + .../fixtures/overlay-config/webpack.config.js | 2 + .../reload-config-2/webpack.config.js | 2 + test/fixtures/simple-config/webpack.config.js | 2 + test/helpers/html-generator-plugin.js | 74 +++++++++++++++++++ 32 files changed, 485 insertions(+), 182 deletions(-) create mode 100644 test/helpers/html-generator-plugin.js diff --git a/test/e2e/__snapshots__/allowed-hosts.test.js.snap.webpack4 b/test/e2e/__snapshots__/allowed-hosts.test.js.snap.webpack4 index b27a958fad..e74c368464 100644 --- a/test/e2e/__snapshots__/allowed-hosts.test.js.snap.webpack4 +++ b/test/e2e/__snapshots__/allowed-hosts.test.js.snap.webpack4 @@ -30,12 +30,6 @@ exports[`allowed hosts check host headers should always allow value from the \`h exports[`allowed hosts check host headers should always allow value from the \`host\` options if options.allowedHosts is auto: response status 1`] = `200`; -exports[`allowed hosts check host headers should always allow value of the \`host\` option from the \`client.webSocketURL\` option if options.allowedHosts is auto: console messages 1`] = `Array []`; - -exports[`allowed hosts check host headers should always allow value of the \`host\` option from the \`client.webSocketURL\` option if options.allowedHosts is auto: page errors 1`] = `Array []`; - -exports[`allowed hosts check host headers should always allow value of the \`host\` option from the \`client.webSocketURL\` option if options.allowedHosts is auto: response status 1`] = `200`; - exports[`allowed hosts should connect web socket client using "[::1] host to web socket server with the "auto" value ("sockjs"): console messages 1`] = ` Array [ "[HMR] Waiting for update signal from WDS...", diff --git a/test/e2e/__snapshots__/allowed-hosts.test.js.snap.webpack5 b/test/e2e/__snapshots__/allowed-hosts.test.js.snap.webpack5 index b27a958fad..e74c368464 100644 --- a/test/e2e/__snapshots__/allowed-hosts.test.js.snap.webpack5 +++ b/test/e2e/__snapshots__/allowed-hosts.test.js.snap.webpack5 @@ -30,12 +30,6 @@ exports[`allowed hosts check host headers should always allow value from the \`h exports[`allowed hosts check host headers should always allow value from the \`host\` options if options.allowedHosts is auto: response status 1`] = `200`; -exports[`allowed hosts check host headers should always allow value of the \`host\` option from the \`client.webSocketURL\` option if options.allowedHosts is auto: console messages 1`] = `Array []`; - -exports[`allowed hosts check host headers should always allow value of the \`host\` option from the \`client.webSocketURL\` option if options.allowedHosts is auto: page errors 1`] = `Array []`; - -exports[`allowed hosts check host headers should always allow value of the \`host\` option from the \`client.webSocketURL\` option if options.allowedHosts is auto: response status 1`] = `200`; - exports[`allowed hosts should connect web socket client using "[::1] host to web socket server with the "auto" value ("sockjs"): console messages 1`] = ` Array [ "[HMR] Waiting for update signal from WDS...", diff --git a/test/e2e/__snapshots__/bonjour.test.js.snap.webpack4 b/test/e2e/__snapshots__/bonjour.test.js.snap.webpack4 index f1699a3b3e..00a8d01b50 100644 --- a/test/e2e/__snapshots__/bonjour.test.js.snap.webpack4 +++ b/test/e2e/__snapshots__/bonjour.test.js.snap.webpack4 @@ -1,36 +1,78 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`bonjour option as object should apply bonjour options: console messages 1`] = `Array []`; +exports[`bonjour option as object should apply bonjour options: console messages 1`] = ` +Array [ + "[HMR] Waiting for update signal from WDS...", + "Hey.", + "[webpack-dev-server] Hot Module Replacement enabled.", + "[webpack-dev-server] Live Reloading enabled.", +] +`; exports[`bonjour option as object should apply bonjour options: page errors 1`] = `Array []`; exports[`bonjour option as object should apply bonjour options: response status 1`] = `200`; -exports[`bonjour option as true should call bonjour with correct params: console messages 1`] = `Array []`; +exports[`bonjour option as true should call bonjour with correct params: console messages 1`] = ` +Array [ + "[HMR] Waiting for update signal from WDS...", + "Hey.", + "[webpack-dev-server] Hot Module Replacement enabled.", + "[webpack-dev-server] Live Reloading enabled.", +] +`; exports[`bonjour option as true should call bonjour with correct params: page errors 1`] = `Array []`; exports[`bonjour option as true should call bonjour with correct params: response status 1`] = `200`; -exports[`bonjour option bonjour object and 'https' should apply bonjour options: console messages 1`] = `Array []`; +exports[`bonjour option bonjour object and 'https' should apply bonjour options: console messages 1`] = ` +Array [ + "[HMR] Waiting for update signal from WDS...", + "Hey.", + "[webpack-dev-server] Hot Module Replacement enabled.", + "[webpack-dev-server] Live Reloading enabled.", +] +`; exports[`bonjour option bonjour object and 'https' should apply bonjour options: page errors 1`] = `Array []`; exports[`bonjour option bonjour object and 'https' should apply bonjour options: response status 1`] = `200`; -exports[`bonjour option bonjour object and 'server' option should apply bonjour options: console messages 1`] = `Array []`; +exports[`bonjour option bonjour object and 'server' option should apply bonjour options: console messages 1`] = ` +Array [ + "[HMR] Waiting for update signal from WDS...", + "Hey.", + "[webpack-dev-server] Hot Module Replacement enabled.", + "[webpack-dev-server] Live Reloading enabled.", +] +`; exports[`bonjour option bonjour object and 'server' option should apply bonjour options: page errors 1`] = `Array []`; exports[`bonjour option bonjour object and 'server' option should apply bonjour options: response status 1`] = `200`; -exports[`bonjour option with 'https' option should call bonjour with 'https' type: console messages 1`] = `Array []`; +exports[`bonjour option with 'https' option should call bonjour with 'https' type: console messages 1`] = ` +Array [ + "[HMR] Waiting for update signal from WDS...", + "Hey.", + "[webpack-dev-server] Hot Module Replacement enabled.", + "[webpack-dev-server] Live Reloading enabled.", +] +`; exports[`bonjour option with 'https' option should call bonjour with 'https' type: page errors 1`] = `Array []`; exports[`bonjour option with 'https' option should call bonjour with 'https' type: response status 1`] = `200`; -exports[`bonjour option with 'server' option should call bonjour with 'https' type: console messages 1`] = `Array []`; +exports[`bonjour option with 'server' option should call bonjour with 'https' type: console messages 1`] = ` +Array [ + "[HMR] Waiting for update signal from WDS...", + "Hey.", + "[webpack-dev-server] Hot Module Replacement enabled.", + "[webpack-dev-server] Live Reloading enabled.", +] +`; exports[`bonjour option with 'server' option should call bonjour with 'https' type: page errors 1`] = `Array []`; diff --git a/test/e2e/__snapshots__/bonjour.test.js.snap.webpack5 b/test/e2e/__snapshots__/bonjour.test.js.snap.webpack5 index f1699a3b3e..00a8d01b50 100644 --- a/test/e2e/__snapshots__/bonjour.test.js.snap.webpack5 +++ b/test/e2e/__snapshots__/bonjour.test.js.snap.webpack5 @@ -1,36 +1,78 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`bonjour option as object should apply bonjour options: console messages 1`] = `Array []`; +exports[`bonjour option as object should apply bonjour options: console messages 1`] = ` +Array [ + "[HMR] Waiting for update signal from WDS...", + "Hey.", + "[webpack-dev-server] Hot Module Replacement enabled.", + "[webpack-dev-server] Live Reloading enabled.", +] +`; exports[`bonjour option as object should apply bonjour options: page errors 1`] = `Array []`; exports[`bonjour option as object should apply bonjour options: response status 1`] = `200`; -exports[`bonjour option as true should call bonjour with correct params: console messages 1`] = `Array []`; +exports[`bonjour option as true should call bonjour with correct params: console messages 1`] = ` +Array [ + "[HMR] Waiting for update signal from WDS...", + "Hey.", + "[webpack-dev-server] Hot Module Replacement enabled.", + "[webpack-dev-server] Live Reloading enabled.", +] +`; exports[`bonjour option as true should call bonjour with correct params: page errors 1`] = `Array []`; exports[`bonjour option as true should call bonjour with correct params: response status 1`] = `200`; -exports[`bonjour option bonjour object and 'https' should apply bonjour options: console messages 1`] = `Array []`; +exports[`bonjour option bonjour object and 'https' should apply bonjour options: console messages 1`] = ` +Array [ + "[HMR] Waiting for update signal from WDS...", + "Hey.", + "[webpack-dev-server] Hot Module Replacement enabled.", + "[webpack-dev-server] Live Reloading enabled.", +] +`; exports[`bonjour option bonjour object and 'https' should apply bonjour options: page errors 1`] = `Array []`; exports[`bonjour option bonjour object and 'https' should apply bonjour options: response status 1`] = `200`; -exports[`bonjour option bonjour object and 'server' option should apply bonjour options: console messages 1`] = `Array []`; +exports[`bonjour option bonjour object and 'server' option should apply bonjour options: console messages 1`] = ` +Array [ + "[HMR] Waiting for update signal from WDS...", + "Hey.", + "[webpack-dev-server] Hot Module Replacement enabled.", + "[webpack-dev-server] Live Reloading enabled.", +] +`; exports[`bonjour option bonjour object and 'server' option should apply bonjour options: page errors 1`] = `Array []`; exports[`bonjour option bonjour object and 'server' option should apply bonjour options: response status 1`] = `200`; -exports[`bonjour option with 'https' option should call bonjour with 'https' type: console messages 1`] = `Array []`; +exports[`bonjour option with 'https' option should call bonjour with 'https' type: console messages 1`] = ` +Array [ + "[HMR] Waiting for update signal from WDS...", + "Hey.", + "[webpack-dev-server] Hot Module Replacement enabled.", + "[webpack-dev-server] Live Reloading enabled.", +] +`; exports[`bonjour option with 'https' option should call bonjour with 'https' type: page errors 1`] = `Array []`; exports[`bonjour option with 'https' option should call bonjour with 'https' type: response status 1`] = `200`; -exports[`bonjour option with 'server' option should call bonjour with 'https' type: console messages 1`] = `Array []`; +exports[`bonjour option with 'server' option should call bonjour with 'https' type: console messages 1`] = ` +Array [ + "[HMR] Waiting for update signal from WDS...", + "Hey.", + "[webpack-dev-server] Hot Module Replacement enabled.", + "[webpack-dev-server] Live Reloading enabled.", +] +`; exports[`bonjour option with 'server' option should call bonjour with 'https' type: page errors 1`] = `Array []`; diff --git a/test/e2e/__snapshots__/built-in-routes.test.js.snap.webpack4 b/test/e2e/__snapshots__/built-in-routes.test.js.snap.webpack4 index 974d461d5e..50391eb34e 100644 --- a/test/e2e/__snapshots__/built-in-routes.test.js.snap.webpack4 +++ b/test/e2e/__snapshots__/built-in-routes.test.js.snap.webpack4 @@ -24,6 +24,8 @@ exports[`Built in routes with simple config should handle GET request to directo exports[`Built in routes with simple config should handle GET request to directory index and list all middleware directories: directory list 1`] = ` "

Assets Report:

Compilation: unnamed