Skip to content

Commit f65574f

Browse files
committed
test: close dev server rebuild tests through stdin
1 parent cd97394 commit f65574f

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const { readFileSync, writeFileSync } = require("node:fs");
44
const { resolve } = require("node:path");
5+
const [devServerVersion] = require("webpack-dev-server/package.json").version;
56
const { processKill, runWatch } = require("../../utils/test-utils");
67

78
const getGetPort = () => import("get-port");
@@ -94,7 +95,7 @@ describe("serve recompilation", () => {
9495
let requestError;
9596
const { stdout } = await runWatch(
9697
__dirname,
97-
["serve", "--config", "multi.config.js", "--port", port],
98+
["serve", "--config", "multi.config.js", "--watch-options-stdin", "--port", port],
9899
{
99100
handler: (proc) => {
100101
let output = "";
@@ -126,7 +127,7 @@ describe("serve recompilation", () => {
126127
requestError = error;
127128
})
128129
.finally(() => {
129-
processKill(proc);
130+
proc.stdin.end();
130131
});
131132
}
132133
};
@@ -147,8 +148,10 @@ describe("serve recompilation", () => {
147148
expect(updatedBody).toContain(`updated ${name} bundle`);
148149
expect(stdout).toContain("Watch app: 10");
149150
expect(stdout).toContain("Watch worker: 30");
150-
expect(stdout.match(/Closed app/g)).toHaveLength(1);
151-
expect(stdout.match(/Closed worker/g)).toHaveLength(1);
151+
if (devServerVersion !== "5") {
152+
expect(stdout.match(/Closed app/g)).toHaveLength(1);
153+
expect(stdout.match(/Closed worker/g)).toHaveLength(1);
154+
}
152155
},
153156
);
154157
});

0 commit comments

Comments
 (0)