Skip to content

Commit

Permalink
Update snapshots to make the tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Siegrift committed May 3, 2022
1 parent eb652fa commit e12147e
Show file tree
Hide file tree
Showing 8 changed files with 212 additions and 74 deletions.
15 changes: 15 additions & 0 deletions bin/cli-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,21 @@ module.exports = {
simpleType: "boolean",
multiple: false,
},
"client-overlay-trusted-types-policy-name": {
configs: [
{
description:
"The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'.",
multiple: false,
path: "client.overlay.trustedTypesPolicyName",
type: "string",
},
],
description:
"The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'.",
multiple: false,
simpleType: "string",
},
"client-overlay-warnings": {
configs: [
{
Expand Down
3 changes: 2 additions & 1 deletion test/cli/__snapshots__/http2-option.test.js.snap.webpack5
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`"http2" CLI option should work using "--http2" 1`] = `
"<i> [webpack-dev-server] SSL certificate: <cwd>/node_modules/.cache/webpack-dev-server/server.pem
"<i> [webpack-dev-server] Generating SSL certificate...
<i> [webpack-dev-server] SSL certificate: <cwd>/node_modules/.cache/webpack-dev-server/server.pem
<i> [webpack-dev-server] Project is running at:
<i> Loopback: https://localhost:<port>/, https://<ip-v4>:<port>/, https://[<ip-v6>]:<port>/
<i> [webpack-dev-server] On Your Network (IPv4): https://<ip-v4>:<port>/
Expand Down
3 changes: 2 additions & 1 deletion test/cli/__snapshots__/https-option.test.js.snap.webpack5
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ exports[`"https" CLI option should warn using "--https-cacert" and "--https-ca"
`;

exports[`"https" CLI option should work using "--https" 1`] = `
"<i> [webpack-dev-server] SSL certificate: <cwd>/node_modules/.cache/webpack-dev-server/server.pem
"<i> [webpack-dev-server] Generating SSL certificate...
<i> [webpack-dev-server] SSL certificate: <cwd>/node_modules/.cache/webpack-dev-server/server.pem
<i> [webpack-dev-server] Project is running at:
<i> Loopback: https://localhost:<port>/, https://<ip-v4>:<port>/, https://[<ip-v6>]:<port>/
<i> [webpack-dev-server] On Your Network (IPv4): https://<ip-v4>:<port>/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ exports[`hot and live reload should work and allow to disable live reload using
Array [
"[webpack-dev-server] Live Reloading enabled.",
"[webpack-dev-server] App updated. Recompiling...",
"[webpack-dev-server] App updated. Recompiling...",
]
`;

Expand Down Expand Up @@ -267,6 +266,8 @@ Array [
"[webpack-dev-server] App updated. Recompiling...",
"[webpack-dev-server] App hot update...",
"[HMR] Checking for updates on the server...",
"[webpack-dev-server] App updated. Recompiling...",
"[webpack-dev-server] Nothing changed.",
"[HMR] Updated modules:",
"[HMR] - ./main.css",
"[HMR] - ../../../node_modules/css-loader/dist/cjs.js!./main.css",
Expand Down
73 changes: 73 additions & 0 deletions test/e2e/__snapshots__/overlay.test.js.snap.webpack5
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,14 @@ exports[`overlay should not show initially, then show on an error, then show oth
"
`;

exports[`overlay should not show overlay when Trusted Types are enabled, but policy is not allowed: page html 1`] = `
"<body>
<h1>webpack-dev-server is running...</h1>
<script type=\\"text/javascript\\" charset=\\"utf-8\\" src=\\"/main.js\\"></script>
</body>
"
`;

exports[`overlay should show a warning after invalidation: overlay html 1`] = `
"<body>
<div
Expand Down Expand Up @@ -1319,3 +1327,68 @@ exports[`overlay should show an error when "client.overlay.warnings" is "true":
</body>
"
`;

exports[`overlay should show overlay when Trusted Types are enabled: overlay html 1`] = `
"<body>
<div
id=\\"webpack-dev-server-client-overlay-div\\"
style=\\"
position: fixed;
box-sizing: border-box;
inset: 0px;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.85);
color: rgb(232, 232, 232);
font-family: Menlo, Consolas, monospace;
font-size: large;
padding: 2rem;
line-height: 1.2;
white-space: pre-wrap;
overflow: auto;
\\"
>
<span>Compiled with problems:</span
><button
style=\\"
background: transparent;
border: none;
font-size: 20px;
font-weight: bold;
color: white;
cursor: pointer;
float: right;
\\"
>
X</button
><br /><br />
<div>
<span style=\\"color: rgb(227, 96, 73)\\">ERROR</span><br /><br />
<div>Error from compilation. Can't find 'test' module.</div>
<br /><br />
</div>
</div>
</body>
"
`;

exports[`overlay should show overlay when Trusted Types are enabled: page html 1`] = `
"<body>
<h1>webpack-dev-server is running...</h1>
<script type=\\"text/javascript\\" charset=\\"utf-8\\" src=\\"/main.js\\"></script>

<iframe
id=\\"webpack-dev-server-client-overlay\\"
src=\\"about:blank\\"
style=\\"
position: fixed;
inset: 0px;
width: 100vw;
height: 100vh;
border: none;
z-index: 2147483647;
\\"
></iframe>
</body>
"
`;
1 change: 1 addition & 0 deletions test/fixtures/static-config/public/node_modules/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions types/bin/cli-flags.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ declare const _exports: {
simpleType: string;
multiple: boolean;
};
"client-overlay-trusted-types-policy-name": {
configs: {
description: string;
multiple: boolean;
path: string;
type: string;
}[];
description: string;
multiple: boolean;
simpleType: string;
};
"client-overlay-warnings": {
configs: {
type: string;
Expand Down
Loading

0 comments on commit e12147e

Please sign in to comment.