Skip to content

Commit 78594da

Browse files
authored
test: add e2e tests for multi compiler mode (#3612)
1 parent a71cc03 commit 78594da

File tree

4 files changed

+70
-35
lines changed

4 files changed

+70
-35
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Multi compiler should work with multiple compilers: console messages 1`] = `
4+
Array [
5+
"[HMR] Waiting for update signal from WDS...",
6+
"Hey.",
7+
"[webpack-dev-server] Hot Module Replacement enabled.",
8+
"[webpack-dev-server] Live Reloading enabled.",
9+
]
10+
`;
11+
12+
exports[`Multi compiler should work with multiple compilers: page errors 1`] = `Array []`;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Multi compiler should work with multiple compilers: console messages 1`] = `
4+
Array [
5+
"[HMR] Waiting for update signal from WDS...",
6+
"Hey.",
7+
"[webpack-dev-server] Hot Module Replacement enabled.",
8+
"[webpack-dev-server] Live Reloading enabled.",
9+
]
10+
`;
11+
12+
exports[`Multi compiler should work with multiple compilers: page errors 1`] = `Array []`;

test/e2e/multi-compiler.test.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
"use strict";
2+
3+
const webpack = require("webpack");
4+
const Server = require("../../lib/Server");
5+
const config = require("../fixtures/multi-compiler-config/webpack.config");
6+
const runBrowser = require("../helpers/run-browser");
7+
const port = require("../ports-map")["multi-compiler"];
8+
9+
describe("Multi compiler", () => {
10+
it(`should work with multiple compilers`, async () => {
11+
const compiler = webpack(config);
12+
const devServerOptions = {
13+
host: "127.0.0.1",
14+
port,
15+
};
16+
const server = new Server(devServerOptions, compiler);
17+
18+
await server.start();
19+
20+
const { page, browser } = await runBrowser();
21+
22+
const pageErrors = [];
23+
const consoleMessages = [];
24+
25+
page
26+
.on("console", (message) => {
27+
consoleMessages.push(message);
28+
})
29+
.on("pageerror", (error) => {
30+
pageErrors.push(error);
31+
});
32+
33+
await page.goto(`http://127.0.0.1:${port}/main`, {
34+
waitUntil: "networkidle0",
35+
});
36+
37+
expect(consoleMessages.map((message) => message.text())).toMatchSnapshot(
38+
"console messages"
39+
);
40+
41+
expect(pageErrors).toMatchSnapshot("page errors");
42+
43+
await browser.close();
44+
await server.close();
45+
});
46+
});

test/integration/MultiCompiler.test.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)