Skip to content

Commit

Permalink
test: fix todo (#3693)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Aug 20, 2021
1 parent 47845fb commit 4ce1e1b
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 5 deletions.
33 changes: 33 additions & 0 deletions test/e2e/__snapshots__/host-and-port.test.js.snap.webpack4
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`host and port should work using "0.0.0.0" host and "auto" port: 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[`host and port should work using "0.0.0.0" host and "auto" port: page errors 1`] = `Array []`;

exports[`host and port should work using "0.0.0.0" host and port as number: 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[`host and port should work using "0.0.0.0" host and port as number: page errors 1`] = `Array []`;

exports[`host and port should work using "0.0.0.0" host and port as string: 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[`host and port should work using "0.0.0.0" host and port as string: page errors 1`] = `Array []`;

exports[`host and port should work using "127.0.0.1" host and "auto" port: console messages 1`] = `
Array [
"[HMR] Waiting for update signal from WDS...",
Expand Down
33 changes: 33 additions & 0 deletions test/e2e/__snapshots__/host-and-port.test.js.snap.webpack5
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`host and port should work using "0.0.0.0" host and "auto" port: 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[`host and port should work using "0.0.0.0" host and "auto" port: page errors 1`] = `Array []`;

exports[`host and port should work using "0.0.0.0" host and port as number: 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[`host and port should work using "0.0.0.0" host and port as number: page errors 1`] = `Array []`;

exports[`host and port should work using "0.0.0.0" host and port as string: 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[`host and port should work using "0.0.0.0" host and port as string: page errors 1`] = `Array []`;

exports[`host and port should work using "127.0.0.1" host and "auto" port: console messages 1`] = `
Array [
"[HMR] Waiting for update signal from WDS...",
Expand Down
16 changes: 11 additions & 5 deletions test/e2e/host-and-port.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const runBrowser = require("../helpers/run-browser");
const port = require("../ports-map")["host-and-port"];

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

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

let hostname = host;

if (hostname === "local-ip" || hostname === "local-ipv4") {
if (hostname === "0.0.0.0") {
hostname = "127.0.0.1";
} else if (hostname === "local-ip" || hostname === "local-ipv4") {
hostname = internalIp.v4.sync();
}

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

let hostname = host;

if (hostname === "local-ip" || hostname === "local-ipv4") {
if (hostname === "0.0.0.0") {
hostname = "127.0.0.1";
} else if (hostname === "local-ip" || hostname === "local-ipv4") {
hostname = internalIp.v4.sync();
}

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

let hostname = host;

if (hostname === "local-ip" || hostname === "local-ipv4") {
if (hostname === "0.0.0.0") {
hostname = "127.0.0.1";
} else if (hostname === "local-ip" || hostname === "local-ipv4") {
hostname = internalIp.v4.sync();
}

Expand Down

0 comments on commit 4ce1e1b

Please sign in to comment.