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
snitin315 authored Sep 19, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent ef2f9e9 commit 375835c
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
@@ -94,8 +94,6 @@ if (typeof parsedResourceQuery.reconnect !== "undefined") {
options.reconnect = Number(parsedResourceQuery.reconnect);
}

logEnabledFeatures(enabledFeatures);

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

logEnabledFeatures(enabledFeatures);

self.addEventListener("beforeunload", () => {
status.isUnloading = true;
});
6 changes: 0 additions & 6 deletions test/e2e/__snapshots__/logging.test.js.snap.webpack4
Original file line number Diff line number Diff line change
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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.",
]
`;
6 changes: 0 additions & 6 deletions test/e2e/__snapshots__/logging.test.js.snap.webpack5
Original file line number Diff line number Diff line change
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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.",
]
`;
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
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
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
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;
@@ -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.",
]
`;

0 comments on commit 375835c

Please sign in to comment.