Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Aug 15, 2021
1 parent 77dbd49 commit b15273a
Show file tree
Hide file tree
Showing 13 changed files with 257 additions and 66 deletions.
5 changes: 4 additions & 1 deletion test/fixtures/client-config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ module.exports = {
path: "/",
},
infrastructureLogging: {
level: "warn",
level: "info",
stream: {
write: () => {},
},
},
plugins: [
{
Expand Down
5 changes: 4 additions & 1 deletion test/fixtures/multi-compiler-config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ module.exports = [
},
node: false,
infrastructureLogging: {
level: "warn",
level: "info",
stream: {
write: () => {},
},
},
},
];
3 changes: 0 additions & 3 deletions test/fixtures/overlay-config/foo.js
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
"use strict";

console.log("Hey.");
5 changes: 4 additions & 1 deletion test/fixtures/overlay-config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ module.exports = {
path: "/",
},
infrastructureLogging: {
level: "warn",
level: "info",
stream: {
write: () => {},
},
},
};
5 changes: 4 additions & 1 deletion test/fixtures/provide-plugin-custom/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ module.exports = {
},
node: false,
infrastructureLogging: {
level: "warn",
level: "info",
stream: {
write: () => {},
},
},
};
5 changes: 4 additions & 1 deletion test/fixtures/provide-plugin-default/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ module.exports = {
},
node: false,
infrastructureLogging: {
level: "warn",
level: "info",
stream: {
write: () => {},
},
},
};
5 changes: 4 additions & 1 deletion test/fixtures/provide-plugin-sockjs-config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ module.exports = {
},
node: false,
infrastructureLogging: {
level: "warn",
level: "info",
stream: {
write: () => {},
},
},
};
5 changes: 4 additions & 1 deletion test/fixtures/provide-plugin-ws-config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ module.exports = {
},
node: false,
infrastructureLogging: {
level: "warn",
level: "info",
stream: {
write: () => {},
},
},
};
5 changes: 4 additions & 1 deletion test/fixtures/reload-config-2/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ module.exports = {
},
node: false,
infrastructureLogging: {
level: "warn",
level: "info",
stream: {
write: () => {},
},
},
};
3 changes: 3 additions & 0 deletions test/fixtures/simple-config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ module.exports = {
node: false,
infrastructureLogging: {
level: "info",
stream: {
write: () => {},
},
},
};
45 changes: 42 additions & 3 deletions test/server/Server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe("Server", () => {
});
});

describe("normalizeOptions", () => {
describe.only("normalizeOptions", () => {
const cases = [
{
title: "no options",
Expand Down Expand Up @@ -291,6 +291,9 @@ describe("Server", () => {
webpackConfig: {
infrastructureLogging: {
level: "verbose",
stream: {
write: () => {},
},
},
},
},
Expand All @@ -306,9 +309,30 @@ describe("Server", () => {
webpackConfig: {
infrastructureLogging: {
level: "verbose",
stream: {
write: () => {},
},
},
},
},
{
title:
"multi compiler client.logging should respect infrastructureLogging.level",
multiCompiler: true,
options: {},
webpackConfig: [
{
target: "node",
},
// infrastructureLogging is set on the second compiler
{
target: "web",
infrastructureLogging: {
level: "warn",
},
},
],
},
{
title:
"multi compiler client.logging should respect infrastructureLogging.level",
Expand All @@ -318,12 +342,28 @@ describe("Server", () => {
{},
// infrastructureLogging is set on the second compiler
{
devServer: {},
infrastructureLogging: {
level: "warn",
},
},
],
},
{
title:
"multi compiler client.logging should respect infrastructureLogging.level",
multiCompiler: true,
options: {},
webpackConfig: [
// Fallback
{
infrastructureLogging: {
level: "warn",
},
},
{},
],
},
{
title:
"multi compiler client.logging should override infrastructureLogging.level",
Expand All @@ -334,13 +374,12 @@ describe("Server", () => {
},
},
webpackConfig: [
{},
// infrastructureLogging is set on the second compiler
{
infrastructureLogging: {
level: "warn",
},
},
{},
],
},
{
Expand Down
116 changes: 90 additions & 26 deletions test/server/__snapshots__/Server.test.js.snap.webpack4
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,6 @@ Array [
]
`;

exports[`Server DevServerPlugin should create and run server with old parameters order and log deprecation warning: oldparam 1`] = `
Array [
Array [
"client",
"index.js?protocol=ws%3A&hostname=localhost&port=8124&pathname=%2Fws&logging=info",
],
Array [
"node_modules",
"webpack",
"hot",
"dev-server.js",
],
Array [
"foo.js",
],
]
`;

exports[`Server Server.getFreePort should throws the error when the port isn't found 1`] = `"busy"`;

exports[`Server normalizeOptions allowedHosts is array 1`] = `
Expand Down Expand Up @@ -791,7 +773,7 @@ Object {
"compress": true,
"devMiddleware": Object {},
"historyApiFallback": false,
"host": "127.0.0.1",
"host": undefined,
"hot": true,
"liveReload": true,
"open": Array [],
Expand Down Expand Up @@ -832,7 +814,7 @@ Object {
"compress": true,
"devMiddleware": Object {},
"historyApiFallback": false,
"host": "127.0.0.1",
"host": undefined,
"hot": true,
"liveReload": true,
"open": Array [],
Expand Down Expand Up @@ -902,7 +884,7 @@ Object {
}
`;

exports[`Server normalizeOptions multi compiler watchOptions is set 1`] = `
exports[`Server normalizeOptions multi compiler client.logging should respect infrastructureLogging.level 2`] = `
Object {
"allowedHosts": "auto",
"bonjour": false,
Expand Down Expand Up @@ -930,9 +912,89 @@ Object {
"icons": true,
},
"staticOptions": Object {},
"watch": Object {
"aggregateTimeout": 300,
"watch": Object {},
},
],
"watchFiles": Array [],
"webSocketServer": Object {
"options": Object {
"path": "/ws",
},
"type": "ws",
},
}
`;

exports[`Server normalizeOptions multi compiler client.logging should respect infrastructureLogging.level 3`] = `
Object {
"allowedHosts": "auto",
"bonjour": false,
"client": Object {
"logging": "warn",
"overlay": true,
"webSocketURL": Object {},
},
"compress": true,
"devMiddleware": Object {},
"historyApiFallback": false,
"host": undefined,
"hot": true,
"liveReload": true,
"open": Array [],
"port": "<auto>",
"setupExitSignals": true,
"static": Array [
Object {
"directory": "<cwd>/public",
"publicPath": Array [
"/",
],
"serveIndex": Object {
"icons": true,
},
"staticOptions": Object {},
"watch": Object {},
},
],
"watchFiles": Array [],
"webSocketServer": Object {
"options": Object {
"path": "/ws",
},
"type": "ws",
},
}
`;

exports[`Server normalizeOptions multi compiler watchOptions is set 1`] = `
Object {
"allowedHosts": "auto",
"bonjour": false,
"client": Object {
"logging": "info",
"overlay": true,
"webSocketURL": Object {},
},
"compress": true,
"devMiddleware": Object {},
"historyApiFallback": false,
"host": undefined,
"hot": true,
"liveReload": true,
"open": Array [],
"port": "<auto>",
"setupExitSignals": true,
"static": Array [
Object {
"directory": "<cwd>/public",
"publicPath": Array [
"/",
],
"serveIndex": Object {
"icons": true,
},
"staticOptions": Object {},
"watch": Object {},
},
],
"watchFiles": Array [],
Expand Down Expand Up @@ -998,7 +1060,7 @@ Object {
"compress": true,
"devMiddleware": Object {},
"historyApiFallback": false,
"host": "127.0.0.1",
"host": undefined,
"hot": true,
"liveReload": true,
"open": Array [],
Expand Down Expand Up @@ -1039,7 +1101,7 @@ Object {
"compress": true,
"devMiddleware": Object {},
"historyApiFallback": false,
"host": "127.0.0.1",
"host": undefined,
"hot": true,
"liveReload": true,
"open": Array [],
Expand Down Expand Up @@ -1266,7 +1328,9 @@ Object {
"icons": true,
},
"staticOptions": Object {},
"watch": Object {},
"watch": Object {
"aggregateTimeout": 300,
},
},
],
"watchFiles": Array [],
Expand Down

0 comments on commit b15273a

Please sign in to comment.