Skip to content

Commit b15273a

Browse files
test: fix
1 parent 77dbd49 commit b15273a

File tree

13 files changed

+257
-66
lines changed

13 files changed

+257
-66
lines changed

test/fixtures/client-config/webpack.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ module.exports = {
2121
path: "/",
2222
},
2323
infrastructureLogging: {
24-
level: "warn",
24+
level: "info",
25+
stream: {
26+
write: () => {},
27+
},
2528
},
2629
plugins: [
2730
{

test/fixtures/multi-compiler-config/webpack.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ module.exports = [
1111
},
1212
node: false,
1313
infrastructureLogging: {
14-
level: "warn",
14+
level: "info",
15+
stream: {
16+
write: () => {},
17+
},
1518
},
1619
},
1720
];

test/fixtures/overlay-config/foo.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
"use strict";
2-
3-
console.log("Hey.");

test/fixtures/overlay-config/webpack.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ module.exports = {
99
path: "/",
1010
},
1111
infrastructureLogging: {
12-
level: "warn",
12+
level: "info",
13+
stream: {
14+
write: () => {},
15+
},
1316
},
1417
};

test/fixtures/provide-plugin-custom/webpack.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ module.exports = {
1010
},
1111
node: false,
1212
infrastructureLogging: {
13-
level: "warn",
13+
level: "info",
14+
stream: {
15+
write: () => {},
16+
},
1417
},
1518
};

test/fixtures/provide-plugin-default/webpack.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ module.exports = {
1010
},
1111
node: false,
1212
infrastructureLogging: {
13-
level: "warn",
13+
level: "info",
14+
stream: {
15+
write: () => {},
16+
},
1417
},
1518
};

test/fixtures/provide-plugin-sockjs-config/webpack.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ module.exports = {
1010
},
1111
node: false,
1212
infrastructureLogging: {
13-
level: "warn",
13+
level: "info",
14+
stream: {
15+
write: () => {},
16+
},
1417
},
1518
};

test/fixtures/provide-plugin-ws-config/webpack.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ module.exports = {
1010
},
1111
node: false,
1212
infrastructureLogging: {
13-
level: "warn",
13+
level: "info",
14+
stream: {
15+
write: () => {},
16+
},
1417
},
1518
};

test/fixtures/reload-config-2/webpack.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ module.exports = {
1818
},
1919
node: false,
2020
infrastructureLogging: {
21-
level: "warn",
21+
level: "info",
22+
stream: {
23+
write: () => {},
24+
},
2225
},
2326
};

test/fixtures/simple-config/webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ module.exports = {
1111
node: false,
1212
infrastructureLogging: {
1313
level: "info",
14+
stream: {
15+
write: () => {},
16+
},
1417
},
1518
};

test/server/Server.test.js

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ describe("Server", () => {
120120
});
121121
});
122122

123-
describe("normalizeOptions", () => {
123+
describe.only("normalizeOptions", () => {
124124
const cases = [
125125
{
126126
title: "no options",
@@ -291,6 +291,9 @@ describe("Server", () => {
291291
webpackConfig: {
292292
infrastructureLogging: {
293293
level: "verbose",
294+
stream: {
295+
write: () => {},
296+
},
294297
},
295298
},
296299
},
@@ -306,9 +309,30 @@ describe("Server", () => {
306309
webpackConfig: {
307310
infrastructureLogging: {
308311
level: "verbose",
312+
stream: {
313+
write: () => {},
314+
},
309315
},
310316
},
311317
},
318+
{
319+
title:
320+
"multi compiler client.logging should respect infrastructureLogging.level",
321+
multiCompiler: true,
322+
options: {},
323+
webpackConfig: [
324+
{
325+
target: "node",
326+
},
327+
// infrastructureLogging is set on the second compiler
328+
{
329+
target: "web",
330+
infrastructureLogging: {
331+
level: "warn",
332+
},
333+
},
334+
],
335+
},
312336
{
313337
title:
314338
"multi compiler client.logging should respect infrastructureLogging.level",
@@ -318,12 +342,28 @@ describe("Server", () => {
318342
{},
319343
// infrastructureLogging is set on the second compiler
320344
{
345+
devServer: {},
321346
infrastructureLogging: {
322347
level: "warn",
323348
},
324349
},
325350
],
326351
},
352+
{
353+
title:
354+
"multi compiler client.logging should respect infrastructureLogging.level",
355+
multiCompiler: true,
356+
options: {},
357+
webpackConfig: [
358+
// Fallback
359+
{
360+
infrastructureLogging: {
361+
level: "warn",
362+
},
363+
},
364+
{},
365+
],
366+
},
327367
{
328368
title:
329369
"multi compiler client.logging should override infrastructureLogging.level",
@@ -334,13 +374,12 @@ describe("Server", () => {
334374
},
335375
},
336376
webpackConfig: [
337-
{},
338-
// infrastructureLogging is set on the second compiler
339377
{
340378
infrastructureLogging: {
341379
level: "warn",
342380
},
343381
},
382+
{},
344383
],
345384
},
346385
{

test/server/__snapshots__/Server.test.js.snap.webpack4

Lines changed: 90 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,6 @@ Array [
3636
]
3737
`;
3838

39-
exports[`Server DevServerPlugin should create and run server with old parameters order and log deprecation warning: oldparam 1`] = `
40-
Array [
41-
Array [
42-
"client",
43-
"index.js?protocol=ws%3A&hostname=localhost&port=8124&pathname=%2Fws&logging=info",
44-
],
45-
Array [
46-
"node_modules",
47-
"webpack",
48-
"hot",
49-
"dev-server.js",
50-
],
51-
Array [
52-
"foo.js",
53-
],
54-
]
55-
`;
56-
5739
exports[`Server Server.getFreePort should throws the error when the port isn't found 1`] = `"busy"`;
5840

5941
exports[`Server normalizeOptions allowedHosts is array 1`] = `
@@ -791,7 +773,7 @@ Object {
791773
"compress": true,
792774
"devMiddleware": Object {},
793775
"historyApiFallback": false,
794-
"host": "127.0.0.1",
776+
"host": undefined,
795777
"hot": true,
796778
"liveReload": true,
797779
"open": Array [],
@@ -832,7 +814,7 @@ Object {
832814
"compress": true,
833815
"devMiddleware": Object {},
834816
"historyApiFallback": false,
835-
"host": "127.0.0.1",
817+
"host": undefined,
836818
"hot": true,
837819
"liveReload": true,
838820
"open": Array [],
@@ -902,7 +884,7 @@ Object {
902884
}
903885
`;
904886

905-
exports[`Server normalizeOptions multi compiler watchOptions is set 1`] = `
887+
exports[`Server normalizeOptions multi compiler client.logging should respect infrastructureLogging.level 2`] = `
906888
Object {
907889
"allowedHosts": "auto",
908890
"bonjour": false,
@@ -930,9 +912,89 @@ Object {
930912
"icons": true,
931913
},
932914
"staticOptions": Object {},
933-
"watch": Object {
934-
"aggregateTimeout": 300,
915+
"watch": Object {},
916+
},
917+
],
918+
"watchFiles": Array [],
919+
"webSocketServer": Object {
920+
"options": Object {
921+
"path": "/ws",
922+
},
923+
"type": "ws",
924+
},
925+
}
926+
`;
927+
928+
exports[`Server normalizeOptions multi compiler client.logging should respect infrastructureLogging.level 3`] = `
929+
Object {
930+
"allowedHosts": "auto",
931+
"bonjour": false,
932+
"client": Object {
933+
"logging": "warn",
934+
"overlay": true,
935+
"webSocketURL": Object {},
936+
},
937+
"compress": true,
938+
"devMiddleware": Object {},
939+
"historyApiFallback": false,
940+
"host": undefined,
941+
"hot": true,
942+
"liveReload": true,
943+
"open": Array [],
944+
"port": "<auto>",
945+
"setupExitSignals": true,
946+
"static": Array [
947+
Object {
948+
"directory": "<cwd>/public",
949+
"publicPath": Array [
950+
"/",
951+
],
952+
"serveIndex": Object {
953+
"icons": true,
954+
},
955+
"staticOptions": Object {},
956+
"watch": Object {},
957+
},
958+
],
959+
"watchFiles": Array [],
960+
"webSocketServer": Object {
961+
"options": Object {
962+
"path": "/ws",
963+
},
964+
"type": "ws",
965+
},
966+
}
967+
`;
968+
969+
exports[`Server normalizeOptions multi compiler watchOptions is set 1`] = `
970+
Object {
971+
"allowedHosts": "auto",
972+
"bonjour": false,
973+
"client": Object {
974+
"logging": "info",
975+
"overlay": true,
976+
"webSocketURL": Object {},
977+
},
978+
"compress": true,
979+
"devMiddleware": Object {},
980+
"historyApiFallback": false,
981+
"host": undefined,
982+
"hot": true,
983+
"liveReload": true,
984+
"open": Array [],
985+
"port": "<auto>",
986+
"setupExitSignals": true,
987+
"static": Array [
988+
Object {
989+
"directory": "<cwd>/public",
990+
"publicPath": Array [
991+
"/",
992+
],
993+
"serveIndex": Object {
994+
"icons": true,
935995
},
996+
"staticOptions": Object {},
997+
"watch": Object {},
936998
},
937999
],
9381000
"watchFiles": Array [],
@@ -998,7 +1060,7 @@ Object {
9981060
"compress": true,
9991061
"devMiddleware": Object {},
10001062
"historyApiFallback": false,
1001-
"host": "127.0.0.1",
1063+
"host": undefined,
10021064
"hot": true,
10031065
"liveReload": true,
10041066
"open": Array [],
@@ -1039,7 +1101,7 @@ Object {
10391101
"compress": true,
10401102
"devMiddleware": Object {},
10411103
"historyApiFallback": false,
1042-
"host": "127.0.0.1",
1104+
"host": undefined,
10431105
"hot": true,
10441106
"liveReload": true,
10451107
"open": Array [],
@@ -1266,7 +1328,9 @@ Object {
12661328
"icons": true,
12671329
},
12681330
"staticOptions": Object {},
1269-
"watch": Object {},
1331+
"watch": Object {
1332+
"aggregateTimeout": 300,
1333+
},
12701334
},
12711335
],
12721336
"watchFiles": Array [],

0 commit comments

Comments
 (0)