Skip to content

Commit ff4550e

Browse files
test: remove redundant test cases related to 3rd party code (#4131)
Co-authored-by: Alexander Akait <[email protected]>
1 parent 0dd1ee6 commit ff4550e

File tree

1 file changed

+0
-57
lines changed

1 file changed

+0
-57
lines changed

test/server/Server.test.js

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,18 @@
22

33
const { relative, sep } = require("path");
44
const webpack = require("webpack");
5-
const sockjs = require("sockjs/lib/transport");
65
const Server = require("../../lib/Server");
76
const config = require("../fixtures/simple-config/webpack.config");
87
const port = require("../ports-map").server;
98
const isWebpack5 = require("../helpers/isWebpack5");
109

11-
jest.mock("sockjs/lib/transport");
12-
1310
const baseDevConfig = {
1411
port,
1512
host: "localhost",
1613
static: false,
1714
};
1815

1916
describe("Server", () => {
20-
describe("sockjs has decorateConnection", () => {
21-
it("add decorateConnection", () => {
22-
expect(typeof sockjs.Session.prototype.decorateConnection).toEqual(
23-
"function"
24-
);
25-
});
26-
});
27-
2817
describe("DevServerPlugin", () => {
2918
let entries;
3019

@@ -115,50 +104,4 @@ describe("Server", () => {
115104
utilSpy.mockRestore();
116105
});
117106
});
118-
119-
// issue: https://github.com/webpack/webpack-dev-server/issues/1724
120-
describe("express.static.mime.types", () => {
121-
it("should success even if mime.types doesn't exist", async () => {
122-
// expect.assertions(1);
123-
124-
jest.mock("express", () => {
125-
const data = jest.requireActual("express");
126-
const { static: st } = data;
127-
const { mime } = st;
128-
129-
delete mime.types;
130-
131-
expect(typeof mime.types).toEqual("undefined");
132-
133-
return { ...data, static: { ...st, mime } };
134-
});
135-
136-
const compiler = webpack(config);
137-
const server = new Server(baseDevConfig, compiler);
138-
139-
let hasStats = false;
140-
141-
compiler.hooks.done.tap("webpack-dev-server", (s) => {
142-
const output = server.getStats(s);
143-
144-
expect(output.errors.length).toEqual(0);
145-
146-
hasStats = true;
147-
});
148-
149-
await server.start();
150-
151-
await new Promise((resolve) => {
152-
const interval = setInterval(() => {
153-
if (hasStats) {
154-
resolve();
155-
156-
clearInterval(interval);
157-
}
158-
}, 100);
159-
});
160-
161-
await server.stop();
162-
});
163-
});
164107
});

0 commit comments

Comments
 (0)