Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Oct 5, 2021
1 parent 6b87661 commit b0e9c36
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Server.js
Expand Up @@ -482,7 +482,7 @@ class Server {
options.client.reconnect = 10;
} else if (options.client.reconnect === true) {
options.client.reconnect = Infinity;
} else {
} else if (options.client.reconnect === false) {
options.client.reconnect = 0;
}

Expand Down
4 changes: 2 additions & 2 deletions test/cli/__snapshots__/basic.test.js.snap.webpack4
Expand Up @@ -63,14 +63,14 @@ Options:
--client-logging <value> Allows to specify options for client script in the browser or disable client script.
--client-progress Prints compilation progress in percentage in the browser.
--no-client-progress Does not print compilation progress in percentage in the browser.
--client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client.
--no-client-reconnect Negative 'client-reconnect' option.
--client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings.
--no-client-overlay Disables a full-screen overlay in the browser when there are compiler errors or warnings.
--client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors.
--no-client-overlay-errors Negative 'client-overlay-errors' option.
--client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings.
--no-client-overlay-warnings Negative 'client-overlay-warnings' option.
--client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client.
--no-client-reconnect Tells dev-server to not to try to connect the client.
--client-web-socket-url <value> Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to).
--client-web-socket-url-hostname <value> Tells clients connected to devServer to use the provided hostname.
--client-web-socket-url-port <value> Tells clients connected to devServer to use the provided port.
Expand Down
27 changes: 27 additions & 0 deletions test/cli/client-option.test.js
Expand Up @@ -105,6 +105,33 @@ describe('"client" CLI option', () => {
expect(exitCode).toEqual(0);
});

it('should work using "--client-reconnect"', async () => {
const { exitCode } = await testBin(["--port", port, "--client-reconnect"]);

expect(exitCode).toEqual(0);
});

it('should work using "--client-reconnect <value>"', async () => {
const { exitCode } = await testBin([
"--port",
port,
"--client-reconnect",
5,
]);

expect(exitCode).toEqual(0);
});

it('should work using "--no-client-reconnect"', async () => {
const { exitCode } = await testBin([
"--port",
port,
"--no-client-reconnect",
]);

expect(exitCode).toEqual(0);
});

it('should work using "--client-web-socket-url"', async () => {
const { exitCode } = await testBin([
"--port",
Expand Down
Expand Up @@ -72,6 +72,7 @@ Array [
"[webpack-dev-server] Hot Module Replacement enabled.",
"liveReload",
"[webpack-dev-server] Live Reloading enabled.",
"reconnect",
"overlay",
"hash",
"ok",
Expand Down
Expand Up @@ -72,6 +72,7 @@ Array [
"[webpack-dev-server] Hot Module Replacement enabled.",
"liveReload",
"[webpack-dev-server] Live Reloading enabled.",
"reconnect",
"overlay",
"hash",
"ok",
Expand Down

0 comments on commit b0e9c36

Please sign in to comment.