Skip to content

Commit

Permalink
test: add e2e tests for getFreePort api method (#4114)
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Dec 16, 2021
1 parent d3858cb commit 5f6d903
Show file tree
Hide file tree
Showing 6 changed files with 422 additions and 143 deletions.
67 changes: 67 additions & 0 deletions test/e2e/__snapshots__/api.test.js.snap.webpack4
Expand Up @@ -26,6 +26,73 @@ exports[`API Invalidate callback should use the provided \`callback\` function:

exports[`API Invalidate callback should use the provided \`callback\` function: response status 1`] = `200`;

exports[`API Server.getFreePort should retry finding the port for up to defaultPortRetry times (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[`API Server.getFreePort should retry finding the port for up to defaultPortRetry times (number): page errors 1`] = `Array []`;

exports[`API Server.getFreePort should retry finding the port for up to defaultPortRetry times (number): response status 1`] = `200`;

exports[`API Server.getFreePort should retry finding the port for up to defaultPortRetry times (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[`API Server.getFreePort should retry finding the port for up to defaultPortRetry times (string): page errors 1`] = `Array []`;

exports[`API Server.getFreePort should retry finding the port for up to defaultPortRetry times (string): response status 1`] = `200`;

exports[`API Server.getFreePort should retry finding the port when serial ports are busy: 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[`API Server.getFreePort should retry finding the port when serial ports are busy: page errors 1`] = `Array []`;

exports[`API Server.getFreePort should retry finding the port when serial ports are busy: response status 1`] = `200`;

exports[`API Server.getFreePort should return the port when the port is \`null\`: 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[`API Server.getFreePort should return the port when the port is \`null\`: page errors 1`] = `Array []`;

exports[`API Server.getFreePort should return the port when the port is \`null\`: response status 1`] = `200`;

exports[`API Server.getFreePort should return the port when the port is undefined: 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[`API Server.getFreePort should return the port when the port is undefined: page errors 1`] = `Array []`;

exports[`API Server.getFreePort should return the port when the port is undefined: response status 1`] = `200`;

exports[`API Server.getFreePort should throw the error when the port isn't found 1`] = `"busy"`;

exports[`API deprecated API should log warning when the "port" and "host" options from options different from arguments ('listen' method): console messages 1`] = `
Array [
"[HMR] Waiting for update signal from WDS...",
Expand Down
67 changes: 67 additions & 0 deletions test/e2e/__snapshots__/api.test.js.snap.webpack5
Expand Up @@ -26,6 +26,73 @@ exports[`API Invalidate callback should use the provided \`callback\` function:

exports[`API Invalidate callback should use the provided \`callback\` function: response status 1`] = `200`;

exports[`API Server.getFreePort should retry finding the port for up to defaultPortRetry times (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[`API Server.getFreePort should retry finding the port for up to defaultPortRetry times (number): page errors 1`] = `Array []`;

exports[`API Server.getFreePort should retry finding the port for up to defaultPortRetry times (number): response status 1`] = `200`;

exports[`API Server.getFreePort should retry finding the port for up to defaultPortRetry times (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[`API Server.getFreePort should retry finding the port for up to defaultPortRetry times (string): page errors 1`] = `Array []`;

exports[`API Server.getFreePort should retry finding the port for up to defaultPortRetry times (string): response status 1`] = `200`;

exports[`API Server.getFreePort should retry finding the port when serial ports are busy: 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[`API Server.getFreePort should retry finding the port when serial ports are busy: page errors 1`] = `Array []`;

exports[`API Server.getFreePort should retry finding the port when serial ports are busy: response status 1`] = `200`;

exports[`API Server.getFreePort should return the port when the port is \`null\`: 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[`API Server.getFreePort should return the port when the port is \`null\`: page errors 1`] = `Array []`;

exports[`API Server.getFreePort should return the port when the port is \`null\`: response status 1`] = `200`;

exports[`API Server.getFreePort should return the port when the port is undefined: 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[`API Server.getFreePort should return the port when the port is undefined: page errors 1`] = `Array []`;

exports[`API Server.getFreePort should return the port when the port is undefined: response status 1`] = `200`;

exports[`API Server.getFreePort should throw the error when the port isn't found 1`] = `"busy"`;

exports[`API deprecated API should log warning when the "port" and "host" options from options different from arguments ('listen' method): console messages 1`] = `
Array [
"[HMR] Waiting for update signal from WDS...",
Expand Down

0 comments on commit 5f6d903

Please sign in to comment.