Skip to content

Commit

Permalink
test: move away from magicHTML in favor of HTMLGeneratorPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Jan 16, 2022
1 parent 10eb171 commit aa9c621
Show file tree
Hide file tree
Showing 32 changed files with 485 additions and 182 deletions.
6 changes: 0 additions & 6 deletions test/e2e/__snapshots__/allowed-hosts.test.js.snap.webpack4
Expand Up @@ -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...",
Expand Down
6 changes: 0 additions & 6 deletions test/e2e/__snapshots__/allowed-hosts.test.js.snap.webpack5
Expand Up @@ -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...",
Expand Down
54 changes: 48 additions & 6 deletions 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 []`;

Expand Down
54 changes: 48 additions & 6 deletions 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 []`;

Expand Down
2 changes: 2 additions & 0 deletions test/e2e/__snapshots__/built-in-routes.test.js.snap.webpack4
Expand Up @@ -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`] = `
"<!DOCTYPE html><html><head><meta charset=\\"utf-8\\"/></head><body><h1>Assets Report:</h1><div><h2>Compilation: unnamed</h2><ul><li>
<strong><a href=\\"index.html\\" target=\\"_blank\\">index.html</a></strong>
</li><li>
<strong><a href=\\"main.js\\" target=\\"_blank\\">main.js</a></strong>
</li><li>
<strong><a href=\\"test.html\\" target=\\"_blank\\">test.html</a></strong>
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/__snapshots__/built-in-routes.test.js.snap.webpack5
Expand Up @@ -25,6 +25,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`] = `
"<!DOCTYPE html><html><head><meta charset=\\"utf-8\\"/></head><body><h1>Assets Report:</h1><div><h2>Compilation: unnamed</h2><ul><li>
<strong><a href=\\"main.js\\" target=\\"_blank\\">main.js</a></strong>
</li><li>
<strong><a href=\\"index.html\\" target=\\"_blank\\">index.html</a></strong>
</li><li>
<strong><a href=\\"test.html\\" target=\\"_blank\\">test.html</a></strong>
</li></ul></div></body></html>"
Expand Down
63 changes: 56 additions & 7 deletions test/e2e/__snapshots__/headers.test.js.snap.webpack4
@@ -1,6 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`headers option as a function returning an array should handle GET request with headers: console messages 1`] = `Array []`;
exports[`headers option as a function returning an array should handle GET request with headers: 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[`headers option as a function returning an array should handle GET request with headers: page errors 1`] = `Array []`;

Expand All @@ -10,7 +17,14 @@ exports[`headers option as a function returning an array should handle GET reque

exports[`headers option as a function returning an array should handle GET request with headers: response status 1`] = `200`;

exports[`headers option as a function should handle GET request with headers as a function: console messages 1`] = `Array []`;
exports[`headers option as a function should handle GET request with headers as a function: 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[`headers option as a function should handle GET request with headers as a function: page errors 1`] = `Array []`;

Expand All @@ -21,23 +35,44 @@ key2=value2"

exports[`headers option as a function should handle GET request with headers as a function: response status 1`] = `200`;

exports[`headers option as a string and support HEAD request should handle HEAD request with headers: console messages 1`] = `Array []`;
exports[`headers option as a string and support HEAD request should handle HEAD request with headers: 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[`headers option as a string and support HEAD request should handle HEAD request with headers: page errors 1`] = `Array []`;

exports[`headers option as a string and support HEAD request should handle HEAD request with headers: response headers x-foo 1`] = `"dev-server headers"`;

exports[`headers option as a string and support HEAD request should handle HEAD request with headers: response status 1`] = `200`;

exports[`headers option as a string should handle GET request with headers: console messages 1`] = `Array []`;
exports[`headers option as a string should handle GET request with headers: 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[`headers option as a string should handle GET request with headers: page errors 1`] = `Array []`;

exports[`headers option as a string should handle GET request with headers: response headers x-foo 1`] = `"dev-server headers"`;

exports[`headers option as a string should handle GET request with headers: response status 1`] = `200`;

exports[`headers option as an array of objects should handle GET request with headers: console messages 1`] = `Array []`;
exports[`headers option as an array of objects should handle GET request with headers: 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[`headers option as an array of objects should handle GET request with headers: page errors 1`] = `Array []`;

Expand All @@ -47,7 +82,14 @@ exports[`headers option as an array of objects should handle GET request with he

exports[`headers option as an array of objects should handle GET request with headers: response status 1`] = `200`;

exports[`headers option as an array should handle GET request with headers as an array: console messages 1`] = `Array []`;
exports[`headers option as an array should handle GET request with headers as an array: 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[`headers option as an array should handle GET request with headers as an array: page errors 1`] = `Array []`;

Expand All @@ -58,7 +100,14 @@ key2=value2"

exports[`headers option as an array should handle GET request with headers as an array: response status 1`] = `200`;

exports[`headers option dev middleware headers take precedence for dev middleware output files should handle GET request with headers as a function: console messages 1`] = `Array []`;
exports[`headers option dev middleware headers take precedence for dev middleware output files should handle GET request with headers as a function: 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[`headers option dev middleware headers take precedence for dev middleware output files should handle GET request with headers as a function: page errors 1`] = `Array []`;

Expand Down

0 comments on commit aa9c621

Please sign in to comment.