Skip to content

Commit 4ce1e1b

Browse files
test: fix todo (#3693)
1 parent 47845fb commit 4ce1e1b

File tree

3 files changed

+77
-5
lines changed

3 files changed

+77
-5
lines changed

test/e2e/__snapshots__/host-and-port.test.js.snap.webpack4

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`host and port should work using "0.0.0.0" host and "auto" port: console messages 1`] = `
4+
Array [
5+
"[HMR] Waiting for update signal from WDS...",
6+
"Hey.",
7+
"[webpack-dev-server] Hot Module Replacement enabled.",
8+
"[webpack-dev-server] Live Reloading enabled.",
9+
]
10+
`;
11+
12+
exports[`host and port should work using "0.0.0.0" host and "auto" port: page errors 1`] = `Array []`;
13+
14+
exports[`host and port should work using "0.0.0.0" host and port as number: console messages 1`] = `
15+
Array [
16+
"[HMR] Waiting for update signal from WDS...",
17+
"Hey.",
18+
"[webpack-dev-server] Hot Module Replacement enabled.",
19+
"[webpack-dev-server] Live Reloading enabled.",
20+
]
21+
`;
22+
23+
exports[`host and port should work using "0.0.0.0" host and port as number: page errors 1`] = `Array []`;
24+
25+
exports[`host and port should work using "0.0.0.0" host and port as string: console messages 1`] = `
26+
Array [
27+
"[HMR] Waiting for update signal from WDS...",
28+
"Hey.",
29+
"[webpack-dev-server] Hot Module Replacement enabled.",
30+
"[webpack-dev-server] Live Reloading enabled.",
31+
]
32+
`;
33+
34+
exports[`host and port should work using "0.0.0.0" host and port as string: page errors 1`] = `Array []`;
35+
336
exports[`host and port should work using "127.0.0.1" host and "auto" port: console messages 1`] = `
437
Array [
538
"[HMR] Waiting for update signal from WDS...",

test/e2e/__snapshots__/host-and-port.test.js.snap.webpack5

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`host and port should work using "0.0.0.0" host and "auto" port: console messages 1`] = `
4+
Array [
5+
"[HMR] Waiting for update signal from WDS...",
6+
"Hey.",
7+
"[webpack-dev-server] Hot Module Replacement enabled.",
8+
"[webpack-dev-server] Live Reloading enabled.",
9+
]
10+
`;
11+
12+
exports[`host and port should work using "0.0.0.0" host and "auto" port: page errors 1`] = `Array []`;
13+
14+
exports[`host and port should work using "0.0.0.0" host and port as number: console messages 1`] = `
15+
Array [
16+
"[HMR] Waiting for update signal from WDS...",
17+
"Hey.",
18+
"[webpack-dev-server] Hot Module Replacement enabled.",
19+
"[webpack-dev-server] Live Reloading enabled.",
20+
]
21+
`;
22+
23+
exports[`host and port should work using "0.0.0.0" host and port as number: page errors 1`] = `Array []`;
24+
25+
exports[`host and port should work using "0.0.0.0" host and port as string: console messages 1`] = `
26+
Array [
27+
"[HMR] Waiting for update signal from WDS...",
28+
"Hey.",
29+
"[webpack-dev-server] Hot Module Replacement enabled.",
30+
"[webpack-dev-server] Live Reloading enabled.",
31+
]
32+
`;
33+
34+
exports[`host and port should work using "0.0.0.0" host and port as string: page errors 1`] = `Array []`;
35+
336
exports[`host and port should work using "127.0.0.1" host and "auto" port: console messages 1`] = `
437
Array [
538
"[HMR] Waiting for update signal from WDS...",

test/e2e/host-and-port.test.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const runBrowser = require("../helpers/run-browser");
88
const port = require("../ports-map")["host-and-port"];
99

1010
describe("host and port", () => {
11-
// TODO: add "0.0.0.0" and "local-ipv6"
12-
const hosts = ["localhost", "127.0.0.1", "local-ip", "local-ipv4"];
11+
// TODO: add "local-ipv6"
12+
const hosts = ["0.0.0.0", "localhost", "127.0.0.1", "local-ip", "local-ipv4"];
1313

1414
for (const host of hosts) {
1515
it(`should work using "${host}" host and port as number`, async () => {
@@ -18,7 +18,9 @@ describe("host and port", () => {
1818

1919
let hostname = host;
2020

21-
if (hostname === "local-ip" || hostname === "local-ipv4") {
21+
if (hostname === "0.0.0.0") {
22+
hostname = "127.0.0.1";
23+
} else if (hostname === "local-ip" || hostname === "local-ipv4") {
2224
hostname = internalIp.v4.sync();
2325
}
2426

@@ -57,7 +59,9 @@ describe("host and port", () => {
5759

5860
let hostname = host;
5961

60-
if (hostname === "local-ip" || hostname === "local-ipv4") {
62+
if (hostname === "0.0.0.0") {
63+
hostname = "127.0.0.1";
64+
} else if (hostname === "local-ip" || hostname === "local-ipv4") {
6165
hostname = internalIp.v4.sync();
6266
}
6367

@@ -99,7 +103,9 @@ describe("host and port", () => {
99103

100104
let hostname = host;
101105

102-
if (hostname === "local-ip" || hostname === "local-ipv4") {
106+
if (hostname === "0.0.0.0") {
107+
hostname = "127.0.0.1";
108+
} else if (hostname === "local-ip" || hostname === "local-ipv4") {
103109
hostname = internalIp.v4.sync();
104110
}
105111

0 commit comments

Comments
 (0)