Skip to content

Commit 8fc6816

Browse files
committed
test: update
1 parent 4be5d8d commit 8fc6816

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

test/server/Server.test.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,18 @@ describe("Server", () => {
9191
});
9292

9393
// TODO: remove this after plugin support is published
94-
it("should create and run server with old parameters order", (done) => {
94+
it("should create and run server with old parameters order and log deprecation warning", (done) => {
9595
const compiler = webpack(config);
96+
const processSpy = jest.spyOn(process, "emitWarning");
97+
9698
const server = new Server(compiler, baseDevConfig);
9799

100+
expect(processSpy).toHaveBeenCalledWith(
101+
"Using 'compiler' as the first argument is deprecated. Please use 'options' as the first argument and 'compiler' as the second argument.",
102+
"DeprecationWarning",
103+
"DEP_WEBPACK_DEV_SERVER_API"
104+
);
105+
98106
compiler.hooks.done.tap("webpack-dev-server", () => {
99107
expect(entries).toMatchSnapshot("oldparam");
100108

@@ -108,6 +116,8 @@ describe("Server", () => {
108116

109117
getEntries(server);
110118
});
119+
120+
processSpy.mockRestore();
111121
});
112122
});
113123

@@ -772,7 +782,7 @@ describe("Server", () => {
772782
port: "9999",
773783
};
774784

775-
server = new Server(compiler, options);
785+
server = new Server(options, compiler);
776786

777787
const warnSpy = jest.fn();
778788

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Array [
3636
]
3737
`;
3838

39-
exports[`Server DevServerPlugin should create and run server with old parameters order: oldparam 1`] = `
39+
exports[`Server DevServerPlugin should create and run server with old parameters order and log deprecation warning: oldparam 1`] = `
4040
Array [
4141
Array [
4242
"client",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Array [
3636
]
3737
`;
3838

39-
exports[`Server DevServerPlugin should create and run server with old parameters order: oldparam 1`] = `
39+
exports[`Server DevServerPlugin should create and run server with old parameters order and log deprecation warning: oldparam 1`] = `
4040
Array [
4141
Array [
4242
"client",

0 commit comments

Comments
 (0)