Skip to content

Commit

Permalink
fix: respect client.logging option for all logs (#4572)
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 authored Sep 19, 2022
1 parent ef2f9e9 commit 375835c
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 48 deletions.
4 changes: 2 additions & 2 deletions client-src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ if (typeof parsedResourceQuery.reconnect !== "undefined") {
options.reconnect = Number(parsedResourceQuery.reconnect);
}

logEnabledFeatures(enabledFeatures);

/**
* @param {string} level
*/
Expand All @@ -111,6 +109,8 @@ if (options.logging) {
setAllLogLevel(options.logging);
}

logEnabledFeatures(enabledFeatures);

self.addEventListener("beforeunload", () => {
status.isUnloading = true;
});
Expand Down
6 changes: 0 additions & 6 deletions test/e2e/__snapshots__/logging.test.js.snap.webpack4
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ Array [

exports[`logging should work and log only error (sockjs) 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
"[webpack-dev-server] Errors while compiling. Reload prevented.",
"[webpack-dev-server] ERROR
Expand All @@ -126,7 +125,6 @@ Error from compilation",

exports[`logging should work and log only error (ws) 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
"[webpack-dev-server] Errors while compiling. Reload prevented.",
"[webpack-dev-server] ERROR
Expand Down Expand Up @@ -160,7 +158,6 @@ Array [

exports[`logging should work and log warning and errors (sockjs) 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
"[webpack-dev-server] Warnings while compiling.",
"[webpack-dev-server] WARNING
Expand All @@ -173,7 +170,6 @@ Error from compilation",

exports[`logging should work and log warning and errors (ws) 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
"[webpack-dev-server] Warnings while compiling.",
"[webpack-dev-server] WARNING
Expand Down Expand Up @@ -240,14 +236,12 @@ Array [

exports[`logging should work when the "client.logging" is "none" (sockjs) 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;

exports[`logging should work when the "client.logging" is "none" (ws) 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand Down
6 changes: 0 additions & 6 deletions test/e2e/__snapshots__/logging.test.js.snap.webpack5
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ Array [

exports[`logging should work and log only error (sockjs) 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
"[webpack-dev-server] Errors while compiling. Reload prevented.",
"[webpack-dev-server] ERROR
Expand All @@ -126,7 +125,6 @@ Error from compilation",

exports[`logging should work and log only error (ws) 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
"[webpack-dev-server] Errors while compiling. Reload prevented.",
"[webpack-dev-server] ERROR
Expand Down Expand Up @@ -160,7 +158,6 @@ Array [

exports[`logging should work and log warning and errors (sockjs) 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
"[webpack-dev-server] Warnings while compiling.",
"[webpack-dev-server] WARNING
Expand All @@ -173,7 +170,6 @@ Error from compilation",

exports[`logging should work and log warning and errors (ws) 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
"[webpack-dev-server] Warnings while compiling.",
"[webpack-dev-server] WARNING
Expand Down Expand Up @@ -240,14 +236,12 @@ Array [

exports[`logging should work when the "client.logging" is "none" (sockjs) 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;

exports[`logging should work when the "client.logging" is "none" (ws) 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand Down
17 changes: 0 additions & 17 deletions test/e2e/__snapshots__/watch-files.test.js.snap.webpack4
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

exports[`watchFiles option should not crash if file doesn't exist should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -13,7 +12,6 @@ exports[`watchFiles option should not crash if file doesn't exist should reload

exports[`watchFiles option should work with array config should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -24,7 +22,6 @@ exports[`watchFiles option should work with array config should reload when file

exports[`watchFiles option should work with object with multiple paths should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -35,7 +32,6 @@ exports[`watchFiles option should work with object with multiple paths should re

exports[`watchFiles option should work with object with single path should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -60,7 +56,6 @@ Object {

exports[`watchFiles option should work with options {"interval":400,"poll":200} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -85,7 +80,6 @@ Object {

exports[`watchFiles option should work with options {"poll":200} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -110,7 +104,6 @@ Object {

exports[`watchFiles option should work with options {"poll":true} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -135,7 +128,6 @@ Object {

exports[`watchFiles option should work with options {"usePolling":false,"interval":200,"poll":400} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -160,7 +152,6 @@ Object {

exports[`watchFiles option should work with options {"usePolling":false,"poll":200} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -185,7 +176,6 @@ Object {

exports[`watchFiles option should work with options {"usePolling":false,"poll":true} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -210,7 +200,6 @@ Object {

exports[`watchFiles option should work with options {"usePolling":false} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -235,7 +224,6 @@ Object {

exports[`watchFiles option should work with options {"usePolling":true,"interval":200,"poll":400} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -260,7 +248,6 @@ Object {

exports[`watchFiles option should work with options {"usePolling":true,"poll":200} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -285,7 +272,6 @@ Object {

exports[`watchFiles option should work with options {"usePolling":true} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -296,7 +282,6 @@ exports[`watchFiles option should work with options {"usePolling":true} should r

exports[`watchFiles option should work with string and glob should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -307,7 +292,6 @@ exports[`watchFiles option should work with string and glob should reload when f

exports[`watchFiles option should work with string and path to directory should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -318,7 +302,6 @@ exports[`watchFiles option should work with string and path to directory should

exports[`watchFiles option should work with string and path to file should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand Down
17 changes: 0 additions & 17 deletions test/e2e/__snapshots__/watch-files.test.js.snap.webpack5
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

exports[`watchFiles option should not crash if file doesn't exist should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -13,7 +12,6 @@ exports[`watchFiles option should not crash if file doesn't exist should reload

exports[`watchFiles option should work with array config should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -24,7 +22,6 @@ exports[`watchFiles option should work with array config should reload when file

exports[`watchFiles option should work with object with multiple paths should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -35,7 +32,6 @@ exports[`watchFiles option should work with object with multiple paths should re

exports[`watchFiles option should work with object with single path should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -60,7 +56,6 @@ Object {

exports[`watchFiles option should work with options {"interval":400,"poll":200} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -85,7 +80,6 @@ Object {

exports[`watchFiles option should work with options {"poll":200} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -110,7 +104,6 @@ Object {

exports[`watchFiles option should work with options {"poll":true} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -135,7 +128,6 @@ Object {

exports[`watchFiles option should work with options {"usePolling":false,"interval":200,"poll":400} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -160,7 +152,6 @@ Object {

exports[`watchFiles option should work with options {"usePolling":false,"poll":200} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -185,7 +176,6 @@ Object {

exports[`watchFiles option should work with options {"usePolling":false,"poll":true} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -210,7 +200,6 @@ Object {

exports[`watchFiles option should work with options {"usePolling":false} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -235,7 +224,6 @@ Object {

exports[`watchFiles option should work with options {"usePolling":true,"interval":200,"poll":400} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -260,7 +248,6 @@ Object {

exports[`watchFiles option should work with options {"usePolling":true,"poll":200} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -285,7 +272,6 @@ Object {

exports[`watchFiles option should work with options {"usePolling":true} should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -296,7 +282,6 @@ exports[`watchFiles option should work with options {"usePolling":true} should r

exports[`watchFiles option should work with string and glob should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -307,7 +292,6 @@ exports[`watchFiles option should work with string and glob should reload when f

exports[`watchFiles option should work with string and path to directory should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand All @@ -318,7 +302,6 @@ exports[`watchFiles option should work with string and path to directory should

exports[`watchFiles option should work with string and path to file should reload when file content is changed: console messages 1`] = `
Array [
"[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.",
"Hey.",
]
`;
Expand Down

0 comments on commit 375835c

Please sign in to comment.