Skip to content

Commit 375835c

Browse files
authoredSep 19, 2022
fix: respect client.logging option for all logs (#4572)
1 parent ef2f9e9 commit 375835c

5 files changed

+2
-48
lines changed
 

‎client-src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ if (typeof parsedResourceQuery.reconnect !== "undefined") {
9494
options.reconnect = Number(parsedResourceQuery.reconnect);
9595
}
9696

97-
logEnabledFeatures(enabledFeatures);
98-
9997
/**
10098
* @param {string} level
10199
*/
@@ -111,6 +109,8 @@ if (options.logging) {
111109
setAllLogLevel(options.logging);
112110
}
113111

112+
logEnabledFeatures(enabledFeatures);
113+
114114
self.addEventListener("beforeunload", () => {
115115
status.isUnloading = true;
116116
});

‎test/e2e/__snapshots__/logging.test.js.snap.webpack4

-6
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ Array [
116116

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

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

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

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

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

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

‎test/e2e/__snapshots__/logging.test.js.snap.webpack5

-6
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ Array [
116116

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

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

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

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

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

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

‎test/e2e/__snapshots__/watch-files.test.js.snap.webpack4

-17
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

‎test/e2e/__snapshots__/watch-files.test.js.snap.webpack5

-17
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.