Skip to content

Commit 9dc0dac

Browse files
committed
test: add multi-compiler configuration and watch options tests
1 parent 906d27e commit 9dc0dac

3 files changed

Lines changed: 43 additions & 0 deletions

File tree

test/serve/rebuild/multi.config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = [
2+
{
3+
name: "app",
4+
mode: "development",
5+
entry: "./src/index.js",
6+
output: { filename: "app.js" },
7+
watchOptions: {
8+
aggregateTimeout: 10,
9+
},
10+
devServer: {},
11+
},
12+
{
13+
name: "worker",
14+
mode: "development",
15+
entry: "./src/index.js",
16+
output: { filename: "worker.js" },
17+
watchOptions: {
18+
aggregateTimeout: 10,
19+
},
20+
},
21+
];

test/serve/rebuild/serve-rebuild.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,19 @@ describe("serve recompilation", () => {
8383

8484
expect(updatedBody).toContain("serve rebuild test updated");
8585
});
86+
87+
it("should watch every compiler of a multi compiler with its own watch options", async () => {
88+
const { stderr, stdout } = await runWatch(
89+
__dirname,
90+
["serve", "--config", "multi.config.js", "--port", port],
91+
{
92+
stdoutKillStr: /compiled successfully/,
93+
stderrKillStr: /Project is running at:/,
94+
},
95+
);
96+
97+
expect(stdout).toContain("app:");
98+
expect(stdout).toContain("worker:");
99+
expect(stderr).toContain("Project is running at:");
100+
});
86101
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
mode: "development",
3+
entry: "./src/index.js",
4+
watchOptions: {
5+
aggregateTimeout: 10,
6+
},
7+
};

0 commit comments

Comments
 (0)