diff --git a/bin/cli-flags.js b/bin/cli-flags.js index d32c38cbb0..a4549786fe 100644 --- a/bin/cli-flags.js +++ b/bin/cli-flags.js @@ -214,7 +214,7 @@ module.exports = { configs: [ { type: "enum", - values: ["sockjs", "ws"], + values: ["ws"], multiple: false, description: "Allows to set custom web socket transport to communicate with dev server.", @@ -1253,7 +1253,7 @@ module.exports = { multiple: false, path: "webSocketServer", type: "enum", - values: ["sockjs", "ws"], + values: ["ws"], }, { description: @@ -1276,7 +1276,7 @@ module.exports = { multiple: false, path: "webSocketServer.type", type: "enum", - values: ["sockjs", "ws"], + values: ["ws"], }, { description: diff --git a/client-src/clients/SockJSClient.js b/client-src/clients/SockJSClient.js deleted file mode 100644 index cd9d67ad48..0000000000 --- a/client-src/clients/SockJSClient.js +++ /dev/null @@ -1,46 +0,0 @@ -import SockJS from "../modules/sockjs-client/index.js"; -import { log } from "../utils/log.js"; - -/** @typedef {import("../index").EXPECTED_ANY} EXPECTED_ANY */ - -/** - * @implements {CommunicationClient} - */ -export default class SockJSClient { - /** - * @param {string} url url - */ - constructor(url) { - // SockJS requires `http` and `https` protocols - this.sock = new SockJS( - url.replace(/^ws:/i, "http:").replace(/^wss:/i, "https:"), - ); - this.sock.onerror = (error) => { - log.error(error); - }; - } - - /** - * @param {(...args: EXPECTED_ANY[]) => void} fn function - */ - onOpen(fn) { - this.sock.onopen = fn; - } - - /** - * @param {(...args: EXPECTED_ANY[]) => void} fn function - */ - onClose(fn) { - this.sock.onclose = fn; - } - - // call f with the message string as the first argument - /** - * @param {(...args: EXPECTED_ANY[]) => void} fn function - */ - onMessage(fn) { - this.sock.onmessage = (err) => { - fn(err.data); - }; - } -} diff --git a/client-src/modules/sockjs-client/index.js b/client-src/modules/sockjs-client/index.js deleted file mode 100644 index 96035e03ab..0000000000 --- a/client-src/modules/sockjs-client/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from "sockjs-client"; diff --git a/client-src/socket.js b/client-src/socket.js index 7fa045a06a..c44e633a3e 100644 --- a/client-src/socket.js +++ b/client-src/socket.js @@ -4,7 +4,7 @@ import WebSocketClient from "./clients/WebSocketClient.js"; import { log } from "./utils/log.js"; /** @typedef {import("./index.js").EXPECTED_ANY} EXPECTED_ANY */ -/** @typedef {import("./clients/SockJSClient")} SockJSClient */ +/** @typedef {WebSocketClient} */ // this WebsocketClient is here as a default fallback, in case the client is not injected /** @type {CommunicationClientConstructor} */ diff --git a/client-src/webpack.config.js b/client-src/webpack.config.js index 210f775f5c..7037f9406f 100644 --- a/client-src/webpack.config.js +++ b/client-src/webpack.config.js @@ -69,13 +69,4 @@ module.exports = [ ), ], }), - merge(baseForModules, { - entry: path.join(__dirname, "modules/sockjs-client/index.js"), - output: { - filename: "sockjs-client/index.js", - library: "SockJS", - libraryTarget: "umd", - globalObject: "(typeof self !== 'undefined' ? self : this)", - }, - }), ]; diff --git a/examples/web-socket-server/sockjs/README.md b/examples/web-socket-server/sockjs/README.md deleted file mode 100644 index a69a36ad9a..0000000000 --- a/examples/web-socket-server/sockjs/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# web-socket-server (sockjs) - -To create a custom server implementation. - -## sockjs - -This mode uses [SockJS-node](https://github.com/sockjs/sockjs-node) as a server. - -**webpack.config.js** - -```js -module.exports = { - // ... - devServer: { - webSocketServer: "sockjs", - }, -}; -``` - -Usage via CLI: - -```console -npx webpack serve --web-socket-server-type sockjs --open -``` - -### What Should Happen - -1. The script should open `http://localhost:8080/` in your default browser. -2. You should see the text on the page itself change to read `Success!`. diff --git a/examples/web-socket-server/sockjs/app.js b/examples/web-socket-server/sockjs/app.js deleted file mode 100644 index 51cf4a396b..0000000000 --- a/examples/web-socket-server/sockjs/app.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; - -const target = document.querySelector("#target"); - -target.classList.add("pass"); -target.innerHTML = "Success!"; diff --git a/examples/web-socket-server/sockjs/webpack.config.js b/examples/web-socket-server/sockjs/webpack.config.js deleted file mode 100644 index 4740693e79..0000000000 --- a/examples/web-socket-server/sockjs/webpack.config.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -// our setup function adds behind-the-scenes bits to the config that all of our -// examples need -const { setup } = require("../../util"); - -module.exports = setup({ - context: __dirname, - entry: "./app.js", - devServer: { - webSocketServer: "sockjs", - }, -}); diff --git a/jest.config.js b/jest.config.js index 197b147833..7bd7b0bb03 100644 --- a/jest.config.js +++ b/jest.config.js @@ -26,9 +26,5 @@ module.exports = { // https://jestjs.io/docs/upgrading-to-jest28#packagejson-exports // https://github.com/microsoft/accessibility-insights-web/pull/5421#issuecomment-1109168149 // - // FIXME: this uuid moduleNameMapper workaround can be removed after sockjs > uuid@v9 release - // https://github.com/uuidjs/uuid/pull/616#issuecomment-1206283882 - // eslint-disable-next-line n/no-extraneous-require - "^uuid$": require.resolve("uuid"), }, }; diff --git a/lib/Server.js b/lib/Server.js index 87c4edb347..d9e9bcc5aa 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -121,16 +121,16 @@ const schema = require("./options.json"); /** * @typedef {object} WebSocketServerConfiguration - * @property {("sockjs" | "ws" | string | (() => WebSocketServerConfiguration))=} type type + * @property {( "ws" | string | (() => WebSocketServerConfiguration))=} type type * @property {Record=} options options */ /** - * @typedef {(import("ws").WebSocket | import("sockjs").Connection & { send: import("ws").WebSocket["send"], terminate: import("ws").WebSocket["terminate"], ping: import("ws").WebSocket["ping"] }) & { isAlive?: boolean }} ClientConnection + * @typedef {(import("ws").WebSocket & { send: import("ws").WebSocket["send"], terminate: import("ws").WebSocket["terminate"], ping: import("ws").WebSocket["ping"] }) & { isAlive?: boolean }} ClientConnection */ /** - * @typedef {import("ws").WebSocketServer | import("sockjs").Server & { close: import("ws").WebSocketServer["close"] }} WebSocketServer + * @typedef {import("ws").WebSocketServer & { close: import("ws").WebSocketServer["close"] }} WebSocketServer */ /** @@ -190,7 +190,7 @@ const schema = require("./options.json"); * @property {(boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions })=} overlay overlay * @property {boolean=} progress progress * @property {(boolean | number)=} reconnect reconnect - * @property {("ws" | "sockjs" | string)=} webSocketTransport web socket transport + * @property {("ws" | string)=} webSocketTransport web socket transport * @property {(string | WebSocketURL)=} webSocketURL web socket URL */ @@ -231,7 +231,7 @@ const schema = require("./options.json"); * @property {(boolean | string | Static | Array)=} static * @property {(ServerType | ServerConfiguration)=} server * @property {(() => Promise)=} app - * @property {(boolean | "sockjs" | "ws" | string | WebSocketServerConfiguration)=} webSocketServer + * @property {(boolean | "ws" | string | WebSocketServerConfiguration)=} webSocketServer * @property {ProxyConfigArray=} proxy * @property {(boolean | string | Open | Array)=} open * @property {boolean=} setupExitSignals @@ -674,28 +674,17 @@ class Server { /** @type {string} */ let hostname; - // SockJS is not supported server mode, so `hostname` and `port` can't specified, let's ignore them - const isSockJSType = webSocketServer.type === "sockjs"; const isWebSocketServerHostDefined = typeof webSocketServer.options.host !== "undefined"; const isWebSocketServerPortDefined = typeof webSocketServer.options.port !== "undefined"; - if ( - isSockJSType && - (isWebSocketServerHostDefined || isWebSocketServerPortDefined) - ) { - this.logger.warn( - "SockJS only supports client mode and does not support custom hostname and port options. Please consider using 'ws' if you need to customize these options.", - ); - } - // We are proxying dev server and need to specify custom `hostname` if (typeof webSocketURL.hostname !== "undefined") { hostname = webSocketURL.hostname; } // Web socket server works on custom `hostname`, only for `ws` because `sock-js` is not support custom `hostname` - else if (isWebSocketServerHostDefined && !isSockJSType) { + else if (isWebSocketServerHostDefined) { hostname = webSocketServer.options.host; } // The `host` option is specified @@ -717,7 +706,7 @@ class Server { port = webSocketURL.port; } // Web socket server works on custom `port`, only for `ws` because `sock-js` is not support custom `port` - else if (isWebSocketServerPortDefined && !isSockJSType) { + else if (isWebSocketServerPortDefined) { port = webSocketServer.options.port; } // The `port` option is specified @@ -1560,9 +1549,7 @@ class Server { (this.options.webSocketServer).type ) === "string" && // @ts-expect-error - (this.options.webSocketServer.type === "ws" || - /** @type {WebSocketServerConfiguration} */ - (this.options.webSocketServer).type === "sockjs"); + this.options.webSocketServer.type === "ws"; let clientTransport; @@ -1589,12 +1576,8 @@ class Server { switch (typeof clientTransport) { case "string": - // could be 'sockjs', 'ws', or a path that should be required - if (clientTransport === "sockjs") { - clientImplementation = require.resolve( - "../client/clients/SockJSClient", - ); - } else if (clientTransport === "ws") { + // could be 'ws', or a path that should be required + if (clientTransport === "ws") { clientImplementation = require.resolve( "../client/clients/WebSocketClient", ); @@ -1616,7 +1599,7 @@ class Server { !isKnownWebSocketServerImplementation ? "When you use custom web socket implementation you must explicitly specify client.webSocketTransport. " : "" - }client.webSocketTransport must be a string denoting a default implementation (e.g. 'sockjs', 'ws') or a full path to a JS file via require.resolve(...) which exports a class `, + }client.webSocketTransport must be a string denoting a default implementation (e.g. 'ws') or a full path to a JS file via require.resolve(...) which exports a class `, ); } @@ -1639,14 +1622,8 @@ class Server { ) ) { case "string": - // Could be 'sockjs', in the future 'ws', or a path that should be required + // Could be 'ws', or a path that should be required if ( - /** @type {WebSocketServerConfiguration} */ ( - this.options.webSocketServer - ).type === "sockjs" - ) { - implementation = require("./servers/SockJSServer"); - } else if ( /** @type {WebSocketServerConfiguration} */ ( this.options.webSocketServer ).type === "ws" @@ -1674,7 +1651,7 @@ class Server { if (!implementationFound) { throw new Error( - "webSocketServer (webSocketServer.type) must be a string denoting a default implementation (e.g. 'ws', 'sockjs'), a full path to " + + "webSocketServer (webSocketServer.type) must be a string denoting a default implementation (e.g. 'ws'), a full path to " + "a JS file which exports a class extending BaseServer (webpack-dev-server/lib/servers/BaseServer.js) " + "via require.resolve(...), or the class itself which extends BaseServer", ); @@ -2065,56 +2042,6 @@ class Server { middleware: /** @type {MiddlewareHandler} */ (this.middleware), }); - // Should be after `webpack-dev-middleware`, otherwise other middlewares might rewrite response - middlewares.push({ - name: "webpack-dev-server-sockjs-bundle", - path: "/__webpack_dev_server__/sockjs.bundle.js", - /** - * @param {Request} req request - * @param {Response} res response - * @param {NextFunction} next next function - * @returns {void} - */ - middleware: (req, res, next) => { - if (req.method !== "GET" && req.method !== "HEAD") { - next(); - return; - } - - const clientPath = path.join( - __dirname, - "..", - "client/modules/sockjs-client/index.js", - ); - - // Express send Etag and other headers by default, so let's keep them for compatibility reasons - if (typeof res.sendFile === "function") { - res.sendFile(clientPath); - return; - } - - let stats; - - try { - // TODO implement `inputFileSystem.createReadStream` in webpack - stats = fs.statSync(clientPath); - } catch { - next(); - return; - } - - res.setHeader("Content-Type", "application/javascript; charset=UTF-8"); - res.setHeader("Content-Length", stats.size); - - if (req.method === "HEAD") { - res.end(); - return; - } - - fs.createReadStream(clientPath).pipe(res); - }, - }); - middlewares.push({ name: "webpack-dev-server-invalidate", path: "/webpack-dev-server/invalidate", @@ -2677,11 +2604,7 @@ class Server { typeof request !== "undefined" ? /** @type {{ [key: string]: string | undefined }} */ (request.headers) - : typeof ( - /** @type {import("sockjs").Connection} */ (client).headers - ) !== "undefined" - ? /** @type {import("sockjs").Connection} */ (client).headers - : undefined; + : undefined; if (!headers) { this.logger.warn( @@ -3315,8 +3238,7 @@ class Server { */ sendMessage(clients, type, data, params) { for (const client of clients) { - // `sockjs` uses `1` to indicate client is ready to accept data - // `ws` uses `WebSocket.OPEN`, but it is mean `1` too + // `ws` uses `WebSocket.OPEN`, which is `1` if (client.readyState === 1) { client.send(JSON.stringify({ type, data, params })); } diff --git a/lib/options.json b/lib/options.json index f5fa540624..116292d8a0 100644 --- a/lib/options.json +++ b/lib/options.json @@ -193,7 +193,7 @@ "link": "https://webpack.js.org/configuration/dev-server/#websockettransport" }, "ClientWebSocketTransportEnum": { - "enum": ["sockjs", "ws"] + "enum": ["ws"] }, "ClientWebSocketTransportString": { "type": "string", @@ -907,7 +907,7 @@ "link": "https://webpack.js.org/configuration/dev-server/#devserverwebsocketserver" }, "WebSocketServerType": { - "enum": ["sockjs", "ws"] + "enum": ["ws"] }, "WebSocketServerEnum": { "anyOf": [ @@ -918,7 +918,7 @@ } }, { - "enum": ["sockjs", "ws"], + "enum": ["ws"], "cli": { "exclude": true } diff --git a/lib/servers/SockJSServer.js b/lib/servers/SockJSServer.js deleted file mode 100644 index 5468355bd7..0000000000 --- a/lib/servers/SockJSServer.js +++ /dev/null @@ -1,128 +0,0 @@ -"use strict"; - -const sockjs = require("sockjs"); -const BaseServer = require("./BaseServer"); - -/** @typedef {import("../Server").WebSocketServerConfiguration} WebSocketServerConfiguration */ -/** @typedef {import("../Server").ClientConnection} ClientConnection */ - -// Workaround for sockjs@~0.3.19 -// sockjs will remove Origin header, however Origin header is required for checking host. -// See https://github.com/webpack/webpack-dev-server/issues/1604 for more information -{ - // @ts-expect-error - const SockjsSession = require("sockjs/lib/transport").Session; - - const { decorateConnection } = SockjsSession.prototype; - - /** - * @param {import("http").IncomingMessage} req request - */ - // eslint-disable-next-line func-names - SockjsSession.prototype.decorateConnection = function (req) { - decorateConnection.call(this, req); - - const { connection } = this; - - if ( - connection.headers && - !("origin" in connection.headers) && - "origin" in req.headers - ) { - connection.headers.origin = req.headers.origin; - } - }; -} - -module.exports = class SockJSServer extends BaseServer { - // options has: error (function), debug (function), server (http/s server), path (string) - /** - * @param {import("../Server")} server server - */ - constructor(server) { - super(server); - - const webSocketServerOptions = - /** @type {NonNullable} */ - ( - /** @type {WebSocketServerConfiguration} */ - (this.server.options.webSocketServer).options - ); - - /** - * @param {NonNullable} options options - * @returns {string} sockjs URL - */ - const getSockjsUrl = (options) => { - if (typeof options.sockjsUrl !== "undefined") { - return options.sockjsUrl; - } - - return "/__webpack_dev_server__/sockjs.bundle.js"; - }; - - this.implementation = sockjs.createServer({ - // Use provided up-to-date sockjs-client - // eslint-disable-next-line camelcase - sockjs_url: getSockjsUrl(webSocketServerOptions), - // Default logger is very annoy. Limit useless logs. - /** - * @param {string} severity severity - * @param {string} line line - */ - log: (severity, line) => { - if (severity === "error") { - this.server.logger.error(line); - } else if (severity === "info") { - this.server.logger.log(line); - } else { - this.server.logger.debug(line); - } - }, - }); - - /** - * @param {import("sockjs").ServerOptions & { path?: string }} options options - * @returns {string | undefined} prefix - */ - const getPrefix = (options) => { - if (typeof options.prefix !== "undefined") { - return options.prefix; - } - - return options.path; - }; - - const options = { - ...webSocketServerOptions, - prefix: getPrefix(webSocketServerOptions), - }; - - this.implementation.installHandlers( - /** @type {import("http").Server} */ (this.server.server), - options, - ); - - this.implementation.on("connection", (client) => { - // @ts-expect-error - // Implement the the same API as for `ws` - client.send = client.write; - // @ts-expect-error - client.terminate = client.close; - - this.clients.push(/** @type {ClientConnection} */ (client)); - - client.on("close", () => { - this.clients.splice( - this.clients.indexOf(/** @type {ClientConnection} */ (client)), - 1, - ); - }); - }); - - // @ts-expect-error - this.implementation.close = (callback) => { - callback(); - }; - } -}; diff --git a/package-lock.json b/package-lock.json index 9680dbf5e1..e1f6f24fbf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,6 @@ "@types/express-serve-static-core": "^4.17.21", "@types/serve-index": "^1.9.4", "@types/serve-static": "^1.15.5", - "@types/sockjs": "^0.3.36", "@types/ws": "^8.5.10", "ansi-html-community": "^0.0.8", "bonjour-service": "^1.2.1", @@ -33,7 +32,6 @@ "schema-utils": "^4.2.0", "selfsigned": "^5.5.0", "serve-index": "^1.9.1", - "sockjs": "^0.3.24", "spdy": "^4.0.2", "webpack-dev-middleware": "^7.4.2", "ws": "^8.18.0" @@ -57,7 +55,6 @@ "@types/graceful-fs": "^4.1.9", "@types/node": "^24.0.14", "@types/node-forge": "^1.3.1", - "@types/sockjs-client": "^1.5.1", "@types/trusted-types": "^2.0.7", "acorn": "^8.14.0", "babel-jest": "^30.0.4", @@ -92,7 +89,6 @@ "readable-stream": "^4.5.2", "require-from-string": "^2.0.2", "rimraf": "^5.0.5", - "sockjs-client": "^1.6.1", "standard-version": "^9.3.0", "style-loader": "^4.0.0", "supertest": "^7.2.2", @@ -5046,22 +5042,6 @@ "@types/send": "<1" } }, - "node_modules/@types/sockjs": { - "version": "0.3.36", - "resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz", - "integrity": "sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==", - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/sockjs-client": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/@types/sockjs-client/-/sockjs-client-1.5.4.tgz", - "integrity": "sha512-zk+uFZeWyvJ5ZFkLIwoGA/DfJ+pYzcZ8eH4H/EILCm2OBZyHH6Hkdna1/UWL/CFruh5wj6ES7g75SvUB0VsH5w==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -11484,16 +11464,6 @@ "bare-events": "^2.7.0" } }, - "node_modules/eventsource": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", - "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.0.0" - } - }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -11753,18 +11723,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/faye-websocket": { - "version": "0.11.4", - "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz", - "integrity": "sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==", - "license": "Apache-2.0", - "dependencies": { - "websocket-driver": ">=0.5.1" - }, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -13426,12 +13384,6 @@ "node": ">= 0.8" } }, - "node_modules/http-parser-js": { - "version": "0.5.10", - "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.10.tgz", - "integrity": "sha512-Pysuw9XpUq5dVc/2SMHpuTY01RFl8fttgcyunjL7eEMhGM3cI4eOmiCycJDVCo/7O7ClfQD3SaI6ftDzqOXYMA==", - "license": "MIT" - }, "node_modules/http-proxy": { "version": "1.18.1", "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", @@ -21160,47 +21112,6 @@ "npm": ">= 3.0.0" } }, - "node_modules/sockjs": { - "version": "0.3.24", - "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.24.tgz", - "integrity": "sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==", - "license": "MIT", - "dependencies": { - "faye-websocket": "^0.11.3", - "uuid": "^8.3.2", - "websocket-driver": "^0.7.4" - } - }, - "node_modules/sockjs-client": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.6.1.tgz", - "integrity": "sha512-2g0tjOR+fRs0amxENLi/q5TiJTqY+WXFOzb5UwXndlK6TO3U/mirZznpx6w34HVMoc3g7cY24yC/ZMIYnDlfkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^3.2.7", - "eventsource": "^2.0.2", - "faye-websocket": "^0.11.4", - "inherits": "^2.0.4", - "url-parse": "^1.5.10" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://tidelift.com/funding/github/npm/sockjs-client" - } - }, - "node_modules/sockjs-client/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, "node_modules/socks": { "version": "2.8.7", "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.7.tgz", @@ -23210,15 +23121,6 @@ "node": ">= 0.4.0" } }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/v8-to-istanbul": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", @@ -23519,29 +23421,6 @@ "node": ">=10.13.0" } }, - "node_modules/websocket-driver": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", - "integrity": "sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==", - "license": "Apache-2.0", - "dependencies": { - "http-parser-js": ">=0.5.1", - "safe-buffer": ">=5.1.0", - "websocket-extensions": ">=0.1.1" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/websocket-extensions": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz", - "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==", - "license": "Apache-2.0", - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/whatwg-encoding": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", diff --git a/package.json b/package.json index 84d2d5b407..e038d45a63 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,6 @@ "@types/express-serve-static-core": "^4.17.21", "@types/serve-index": "^1.9.4", "@types/serve-static": "^1.15.5", - "@types/sockjs": "^0.3.36", "@types/ws": "^8.5.10", "ansi-html-community": "^0.0.8", "bonjour-service": "^1.2.1", @@ -68,7 +67,6 @@ "schema-utils": "^4.2.0", "selfsigned": "^5.5.0", "serve-index": "^1.9.1", - "sockjs": "^0.3.24", "spdy": "^4.0.2", "webpack-dev-middleware": "^7.4.2", "ws": "^8.18.0" @@ -89,7 +87,6 @@ "@types/graceful-fs": "^4.1.9", "@types/node": "^24.0.14", "@types/node-forge": "^1.3.1", - "@types/sockjs-client": "^1.5.1", "@types/trusted-types": "^2.0.7", "acorn": "^8.14.0", "babel-jest": "^30.0.4", @@ -124,7 +121,6 @@ "readable-stream": "^4.5.2", "require-from-string": "^2.0.2", "rimraf": "^5.0.5", - "sockjs-client": "^1.6.1", "standard-version": "^9.3.0", "style-loader": "^4.0.0", "supertest": "^7.2.2", diff --git a/test/__snapshots__/normalize-options.test.js.snap.webpack5 b/test/__snapshots__/normalize-options.test.js.snap.webpack5 index 436119cd68..06c223f976 100644 --- a/test/__snapshots__/normalize-options.test.js.snap.webpack5 +++ b/test/__snapshots__/normalize-options.test.js.snap.webpack5 @@ -403,63 +403,6 @@ exports[`normalize options client path without leading/ending slashes 1`] = ` } `; -exports[`normalize options client.webSocketTransport sockjs string 1`] = ` -{ - "allowedHosts": "auto", - "bonjour": false, - "client": { - "logging": "info", - "overlay": true, - "reconnect": 10, - "webSocketTransport": "sockjs", - "webSocketURL": {}, - }, - "compress": true, - "devMiddleware": {}, - "historyApiFallback": false, - "host": undefined, - "hot": true, - "liveReload": true, - "open": [], - "port": "", - "server": { - "options": {}, - "type": "http", - }, - "setupExitSignals": true, - "static": [ - { - "directory": "/public", - "publicPath": [ - "/", - ], - "serveIndex": { - "icons": true, - }, - "staticOptions": {}, - "watch": { - "alwaysStat": true, - "atomic": false, - "followSymlinks": false, - "ignoreInitial": true, - "ignorePermissionErrors": true, - "ignored": undefined, - "interval": undefined, - "persistent": true, - "usePolling": false, - }, - }, - ], - "watchFiles": [], - "webSocketServer": { - "options": { - "path": "/ws", - }, - "type": "ws", - }, -} -`; - exports[`normalize options client.webSocketTransport ws string 1`] = ` { "allowedHosts": "auto", diff --git a/test/__snapshots__/validate-options.test.js.snap.webpack5 b/test/__snapshots__/validate-options.test.js.snap.webpack5 index 840a0143c1..b043e1c9ee 100644 --- a/test/__snapshots__/validate-options.test.js.snap.webpack5 +++ b/test/__snapshots__/validate-options.test.js.snap.webpack5 @@ -189,12 +189,11 @@ exports[`options validate should throw an error on the "client" option with '{"w -> Read more at https://webpack.js.org/configuration/dev-server/#devserverclient Details: * options.client.webSocketTransport should be one of these: - "sockjs" | "ws" | non-empty string + "ws" | non-empty string -> Allows to set custom web socket transport to communicate with dev server. -> Read more at https://webpack.js.org/configuration/dev-server/#websockettransport Details: - * options.client.webSocketTransport should be one of these: - "sockjs" | "ws" + * options.client.webSocketTransport should be "ws". * options.client.webSocketTransport should be a non-empty string." `; @@ -787,15 +786,14 @@ exports[`options validate should throw an error on the "webSocketServer" option exports[`options validate should throw an error on the "webSocketServer" option with '{"type":false}' value 1`] = ` "ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options.webSocketServer should be one of these: - false | "sockjs" | "ws" | non-empty string | function | object { type?, options? } + false | "ws" | non-empty string | function | object { type?, options? } -> Allows to set web socket server and options (by default 'ws'). -> Read more at https://webpack.js.org/configuration/dev-server/#devserverwebsocketserver Details: * options.webSocketServer.type should be one of these: - "sockjs" | "ws" | non-empty string | function + "ws" | non-empty string | function Details: - * options.webSocketServer.type should be one of these: - "sockjs" | "ws" + * options.webSocketServer.type should be "ws". * options.webSocketServer.type should be a non-empty string. * options.webSocketServer.type should be an instance of function." `; @@ -803,15 +801,14 @@ exports[`options validate should throw an error on the "webSocketServer" option exports[`options validate should throw an error on the "webSocketServer" option with '{"type":true}' value 1`] = ` "ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options.webSocketServer should be one of these: - false | "sockjs" | "ws" | non-empty string | function | object { type?, options? } + false | "ws" | non-empty string | function | object { type?, options? } -> Allows to set web socket server and options (by default 'ws'). -> Read more at https://webpack.js.org/configuration/dev-server/#devserverwebsocketserver Details: * options.webSocketServer.type should be one of these: - "sockjs" | "ws" | non-empty string | function + "ws" | non-empty string | function Details: - * options.webSocketServer.type should be one of these: - "sockjs" | "ws" + * options.webSocketServer.type should be "ws". * options.webSocketServer.type should be a non-empty string. * options.webSocketServer.type should be an instance of function." `; @@ -819,16 +816,15 @@ exports[`options validate should throw an error on the "webSocketServer" option exports[`options validate should throw an error on the "webSocketServer" option with 'null' value 1`] = ` "ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options.webSocketServer should be one of these: - false | "sockjs" | "ws" | non-empty string | function | object { type?, options? } + false | "ws" | non-empty string | function | object { type?, options? } -> Allows to set web socket server and options (by default 'ws'). -> Read more at https://webpack.js.org/configuration/dev-server/#devserverwebsocketserver Details: * options.webSocketServer should be one of these: - false | "sockjs" | "ws" + false | "ws" Details: * options.webSocketServer should be false. - * options.webSocketServer should be one of these: - "sockjs" | "ws" + * options.webSocketServer should be "ws". * options.webSocketServer should be a non-empty string. * options.webSocketServer should be an instance of function. * options.webSocketServer should be an object: @@ -838,16 +834,15 @@ exports[`options validate should throw an error on the "webSocketServer" option exports[`options validate should throw an error on the "webSocketServer" option with 'true' value 1`] = ` "ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options.webSocketServer should be one of these: - false | "sockjs" | "ws" | non-empty string | function | object { type?, options? } + false | "ws" | non-empty string | function | object { type?, options? } -> Allows to set web socket server and options (by default 'ws'). -> Read more at https://webpack.js.org/configuration/dev-server/#devserverwebsocketserver Details: * options.webSocketServer should be one of these: - false | "sockjs" | "ws" + false | "ws" Details: * options.webSocketServer should be false. - * options.webSocketServer should be one of these: - "sockjs" | "ws" + * options.webSocketServer should be "ws". * options.webSocketServer should be a non-empty string. * options.webSocketServer should be an instance of function. * options.webSocketServer should be an object: diff --git a/test/cli/__snapshots__/server-option.test.js.snap.webpack5 b/test/cli/__snapshots__/server-option.test.js.snap.webpack5 index 62011435d3..3c19bae52b 100644 --- a/test/cli/__snapshots__/server-option.test.js.snap.webpack5 +++ b/test/cli/__snapshots__/server-option.test.js.snap.webpack5 @@ -35,8 +35,7 @@ exports[`"server" CLI options should work using "--server-options-key-reset --se `; exports[`"server" CLI options should work using "--server-options-request-cert" 1`] = ` -" [webpack-dev-server] Generating SSL certificate... - [webpack-dev-server] SSL certificate: /node_modules/.cache/webpack-dev-server/server.pem +" [webpack-dev-server] SSL certificate: /node_modules/.cache/webpack-dev-server/server.pem [webpack-dev-server] Project is running at: Loopback: https://localhost:/, https://:/, https://[]:/ [webpack-dev-server] On Your Network (IPv4): https://:/ diff --git a/test/cli/client-option.test.js b/test/cli/client-option.test.js index d9c95c609f..0fd38d6af8 100644 --- a/test/cli/client-option.test.js +++ b/test/cli/client-option.test.js @@ -4,17 +4,6 @@ const { testBin } = require("../helpers/test-bin"); const port = require("../ports-map")["cli-client"]; describe('"client" CLI option', () => { - it('should work using "--client-web-socket-transport sockjs"', async () => { - const { exitCode } = await testBin([ - "--port", - port, - "--client-web-socket-transport", - "sockjs", - ]); - - expect(exitCode).toBe(0); - }); - it('should work using "--client-web-socket-transport ws"', async () => { const { exitCode } = await testBin([ "--port", diff --git a/test/cli/webSocketServer-option.test.js b/test/cli/webSocketServer-option.test.js index ec383cd767..e7394c8933 100644 --- a/test/cli/webSocketServer-option.test.js +++ b/test/cli/webSocketServer-option.test.js @@ -15,17 +15,6 @@ describe('"webSocketServer" CLI option', () => { expect(exitCode).toBe(0); }); - it('should work using "--web-socket-server-type sockjs"', async () => { - const { exitCode } = await testBin([ - "--port", - port, - "--web-socket-server-type", - "sockjs", - ]); - - expect(exitCode).toBe(0); - }); - it('should work using "--no-web-socket-server"', async () => { const { exitCode } = await testBin([ "--port", diff --git a/test/client/clients/SockJSClient.test.js b/test/client/clients/SockJSClient.test.js deleted file mode 100644 index ae388b5f20..0000000000 --- a/test/client/clients/SockJSClient.test.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @jest-environment jsdom - */ - -"use strict"; - -const http = require("node:http"); -const express = require("express"); -const sockjs = require("sockjs"); -const port = require("../../ports-map")["sockjs-client"]; - -jest.setMock("../../../client-src/utils/log", { - log: { - error: jest.fn(), - }, -}); - -describe("SockJSClient", () => { - const SockJSClient = - require("../../../client-src/clients/SockJSClient").default; - const { log } = require("../../../client-src/utils/log"); - - let consoleMock; - let socketServer; - let server; - - beforeAll((done) => { - consoleMock = jest.spyOn(console, "log").mockImplementation(); - - // eslint-disable-next-line new-cap - const app = new express(); - - server = http.createServer(app); - server.listen(port, "localhost", () => { - socketServer = sockjs.createServer(); - socketServer.installHandlers(server, { - prefix: "/ws", - }); - done(); - }); - }); - - afterAll((done) => { - consoleMock.mockRestore(); - server.close(() => { - done(); - }); - }); - - describe("client", () => { - it("should open, receive message, and close", (done) => { - socketServer.on("connection", (connection) => { - connection.write("hello world"); - - setTimeout(() => { - connection.close(); - }, 1000); - }); - - const client = new SockJSClient(`http://localhost:${port}/ws`); - const data = []; - - client.onOpen(() => { - data.push("open"); - }); - client.onClose(() => { - data.push("close"); - }); - client.onMessage((msg) => { - data.push(msg); - }); - - const testError = new Error("test"); - - client.sock.onerror(testError); - - expect(log.error.mock.calls).toHaveLength(1); - expect(log.error.mock.calls[0]).toEqual([testError]); - - setTimeout(() => { - expect(data).toMatchSnapshot(); - - done(); - }, 3000); - }); - }); -}); diff --git a/test/client/clients/__snapshots__/SockJSClient.test.js.snap.webpack5 b/test/client/clients/__snapshots__/SockJSClient.test.js.snap.webpack5 deleted file mode 100644 index 79ed1603fe..0000000000 --- a/test/client/clients/__snapshots__/SockJSClient.test.js.snap.webpack5 +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing - -exports[`SockJSClient client should open, receive message, and close 1`] = ` -[ - "open", - "hello world", - "close", -] -`; diff --git a/test/e2e/__snapshots__/allowed-hosts.test.js.snap.webpack5 b/test/e2e/__snapshots__/allowed-hosts.test.js.snap.webpack5 index edd5d77571..4f79109c83 100644 --- a/test/e2e/__snapshots__/allowed-hosts.test.js.snap.webpack5 +++ b/test/e2e/__snapshots__/allowed-hosts.test.js.snap.webpack5 @@ -42,16 +42,6 @@ exports[`allowed hosts check host headers should always allow value of the \`hos exports[`allowed hosts check host headers should always allow value of the \`host\` option from the \`client.webSocketURL\` option if options.allowedHosts is auto: response status 1`] = `200`; -exports[`allowed hosts should connect web socket client using "[::1] host to web socket server with the "auto" value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using "[::1] host to web socket server with the "auto" value ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using "[::1] host to web socket server with the "auto" value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -62,16 +52,6 @@ exports[`allowed hosts should connect web socket client using "[::1] host to web exports[`allowed hosts should connect web socket client using "[::1] host to web socket server with the "auto" value ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should connect web socket client using "0.0.0.0" host to web socket server with the "auto" value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using "0.0.0.0" host to web socket server with the "auto" value ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using "0.0.0.0" host to web socket server with the "auto" value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -82,16 +62,6 @@ exports[`allowed hosts should connect web socket client using "0.0.0.0" host to exports[`allowed hosts should connect web socket client using "0.0.0.0" host to web socket server with the "auto" value ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should connect web socket client using "127.0.0.1" host to web socket server by default ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using "127.0.0.1" host to web socket server by default ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using "127.0.0.1" host to web socket server by default ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -102,16 +72,6 @@ exports[`allowed hosts should connect web socket client using "127.0.0.1" host t exports[`allowed hosts should connect web socket client using "127.0.0.1" host to web socket server by default ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should connect web socket client using "127.0.0.1" host to web socket server with the "auto" value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using "127.0.0.1" host to web socket server with the "auto" value ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using "127.0.0.1" host to web socket server with the "auto" value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -122,16 +82,6 @@ exports[`allowed hosts should connect web socket client using "127.0.0.1" host t exports[`allowed hosts should connect web socket client using "127.0.0.1" host to web socket server with the "auto" value ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should connect web socket client using "chrome-extension:" protocol to web socket server with the "auto" value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using "chrome-extension:" protocol to web socket server with the "auto" value ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using "chrome-extension:" protocol to web socket server with the "auto" value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -142,16 +92,6 @@ exports[`allowed hosts should connect web socket client using "chrome-extension: exports[`allowed hosts should connect web socket client using "chrome-extension:" protocol to web socket server with the "auto" value ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should connect web socket client using "file:" protocol to web socket server with the "auto" value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using "file:" protocol to web socket server with the "auto" value ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using "file:" protocol to web socket server with the "auto" value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -162,16 +102,6 @@ exports[`allowed hosts should connect web socket client using "file:" protocol t exports[`allowed hosts should connect web socket client using "file:" protocol to web socket server with the "auto" value ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should connect web socket client using "localhost" host to web socket server by default ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using "localhost" host to web socket server by default ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using "localhost" host to web socket server by default ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -182,16 +112,6 @@ exports[`allowed hosts should connect web socket client using "localhost" host t exports[`allowed hosts should connect web socket client using "localhost" host to web socket server by default ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the "all" value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the "all" value ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the "all" value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -202,16 +122,6 @@ exports[`allowed hosts should connect web socket client using custom hostname to exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the "all" value ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the "all" value in array ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the "all" value in array ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the "all" value in array ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -222,16 +132,6 @@ exports[`allowed hosts should connect web socket client using custom hostname to exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the "all" value in array ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the custom hostname value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the custom hostname value ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the custom hostname value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -242,16 +142,6 @@ exports[`allowed hosts should connect web socket client using custom hostname to exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the custom hostname value ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the custom hostname value starting with dot ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the custom hostname value starting with dot ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the custom hostname value starting with dot ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -262,16 +152,6 @@ exports[`allowed hosts should connect web socket client using custom hostname to exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the custom hostname value starting with dot ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the multiple custom hostname values ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the multiple custom hostname values ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the multiple custom hostname values ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -282,16 +162,6 @@ exports[`allowed hosts should connect web socket client using custom hostname to exports[`allowed hosts should connect web socket client using custom hostname to web socket server with the multiple custom hostname values ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should connect web socket client using custom sub hostname to web socket server with the custom hostname value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using custom sub hostname to web socket server with the custom hostname value ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using custom sub hostname to web socket server with the custom hostname value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -302,16 +172,6 @@ exports[`allowed hosts should connect web socket client using custom sub hostnam exports[`allowed hosts should connect web socket client using custom sub hostname to web socket server with the custom hostname value ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should connect web socket client using localhost to web socket server with the "auto" value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using localhost to web socket server with the "auto" value ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using localhost to web socket server with the "auto" value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -322,16 +182,6 @@ exports[`allowed hosts should connect web socket client using localhost to web s exports[`allowed hosts should connect web socket client using localhost to web socket server with the "auto" value ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should connect web socket client using origin header containing an IP address with the custom hostname value ("sockjs"): (work) console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`allowed hosts should connect web socket client using origin header containing an IP address with the custom hostname value ("sockjs"): (work) page errors 1`] = `[]`; - exports[`allowed hosts should connect web socket client using origin header containing an IP address with the custom hostname value ("ws"): (work) console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -342,16 +192,6 @@ exports[`allowed hosts should connect web socket client using origin header cont exports[`allowed hosts should connect web socket client using origin header containing an IP address with the custom hostname value ("ws"): (work) page errors 1`] = `[]`; -exports[`allowed hosts should disconnect web client using localhost to web socket server with the "auto" value ("sockjs"): console messages 1`] = ` -[ - "Failed to load resource: the server responded with a status of 403 (Forbidden)", -] -`; - -exports[`allowed hosts should disconnect web client using localhost to web socket server with the "auto" value ("sockjs"): html 1`] = `"
Invalid Host header
"`; - -exports[`allowed hosts should disconnect web client using localhost to web socket server with the "auto" value ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should disconnect web client using localhost to web socket server with the "auto" value ("ws"): console messages 1`] = ` [ "Failed to load resource: the server responded with a status of 403 (Forbidden)", @@ -362,19 +202,6 @@ exports[`allowed hosts should disconnect web client using localhost to web socke exports[`allowed hosts should disconnect web client using localhost to web socket server with the "auto" value ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should disconnect web client using origin header containing an IP address with the "auto" value ("sockjs"): (work) console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", - "[webpack-dev-server] Invalid Host/Origin header", - "[webpack-dev-server] Disconnected!", - "[webpack-dev-server] Trying to reconnect...", -] -`; - -exports[`allowed hosts should disconnect web client using origin header containing an IP address with the "auto" value ("sockjs"): (work) page errors 1`] = `[]`; - exports[`allowed hosts should disconnect web client using origin header containing an IP address with the "auto" value ("ws"): (work) console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -388,19 +215,6 @@ exports[`allowed hosts should disconnect web client using origin header containi exports[`allowed hosts should disconnect web client using origin header containing an IP address with the "auto" value ("ws"): (work) page errors 1`] = `[]`; -exports[`allowed hosts should disconnect web socket client using custom hostname from web socket server with the "auto" value based on the "host" header ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", - "[webpack-dev-server] Invalid Host/Origin header", - "[webpack-dev-server] Disconnected!", - "[webpack-dev-server] Trying to reconnect...", -] -`; - -exports[`allowed hosts should disconnect web socket client using custom hostname from web socket server with the "auto" value based on the "host" header ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should disconnect web socket client using custom hostname from web socket server with the "auto" value based on the "host" header ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -414,19 +228,6 @@ exports[`allowed hosts should disconnect web socket client using custom hostname exports[`allowed hosts should disconnect web socket client using custom hostname from web socket server with the "auto" value based on the "host" header ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should disconnect web socket client using custom hostname from web socket server with the "auto" value based on the "host" header when "server: 'https'" is enabled ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", - "[webpack-dev-server] Invalid Host/Origin header", - "[webpack-dev-server] Disconnected!", - "[webpack-dev-server] Trying to reconnect...", -] -`; - -exports[`allowed hosts should disconnect web socket client using custom hostname from web socket server with the "auto" value based on the "host" header when "server: 'https'" is enabled ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should disconnect web socket client using custom hostname from web socket server with the "auto" value based on the "host" header when "server: 'https'" is enabled ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -440,19 +241,6 @@ exports[`allowed hosts should disconnect web socket client using custom hostname exports[`allowed hosts should disconnect web socket client using custom hostname from web socket server with the "auto" value based on the "host" header when "server: 'https'" is enabled ("ws"): page errors 1`] = `[]`; -exports[`allowed hosts should disconnect web socket client using custom hostname from web socket server with the "auto" value based on the "origin" header ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", - "[webpack-dev-server] Invalid Host/Origin header", - "[webpack-dev-server] Disconnected!", - "[webpack-dev-server] Trying to reconnect...", -] -`; - -exports[`allowed hosts should disconnect web socket client using custom hostname from web socket server with the "auto" value based on the "origin" header ("sockjs"): page errors 1`] = `[]`; - exports[`allowed hosts should disconnect web socket client using custom hostname from web socket server with the "auto" value based on the "origin" header ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", diff --git a/test/e2e/__snapshots__/api.test.js.snap.webpack5 b/test/e2e/__snapshots__/api.test.js.snap.webpack5 index 0d6367ba1f..14c74e33ea 100644 --- a/test/e2e/__snapshots__/api.test.js.snap.webpack5 +++ b/test/e2e/__snapshots__/api.test.js.snap.webpack5 @@ -29,7 +29,7 @@ exports[`API Server.checkHostHeader should allow URLs with scheme for checking o "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", "[HMR] Waiting for update signal from WDS...", "Hey.", - "WebSocket connection to 'ws://test.host:8158/ws' failed: Error in connection establishment: net::ERR_NAME_NOT_RESOLVED", + "WebSocket connection to 'ws://test.host:8156/ws' failed: Error in connection establishment: net::ERR_NAME_NOT_RESOLVED", "[webpack-dev-server] JSHandle@object", "[webpack-dev-server] Disconnected!", "[webpack-dev-server] Trying to reconnect...", @@ -40,7 +40,7 @@ exports[`API Server.checkHostHeader should allow URLs with scheme for checking o exports[`API Server.checkHostHeader should allow URLs with scheme for checking origin when the "option.client.webSocketURL" is object: response status 1`] = `200`; -exports[`API Server.checkHostHeader should allow URLs with scheme for checking origin when the "option.client.webSocketURL" is object: web socket URL 1`] = `"ws://test.host:8158/ws"`; +exports[`API Server.checkHostHeader should allow URLs with scheme for checking origin when the "option.client.webSocketURL" is object: web socket URL 1`] = `"ws://test.host:8156/ws"`; exports[`API Server.getFreePort should retry finding the port for up to defaultPortRetry times (number): console messages 1`] = ` [ diff --git a/test/e2e/__snapshots__/built-in-routes.test.js.snap.webpack5 b/test/e2e/__snapshots__/built-in-routes.test.js.snap.webpack5 index 789e304fbe..c3df0191d7 100644 --- a/test/e2e/__snapshots__/built-in-routes.test.js.snap.webpack5 +++ b/test/e2e/__snapshots__/built-in-routes.test.js.snap.webpack5 @@ -65,19 +65,3 @@ exports[`Built in routes with simple config should handle HEAD request to magic exports[`Built in routes with simple config should handle HEAD request to magic async chunk: response headers content-type 1`] = `"text/javascript; charset=utf-8"`; exports[`Built in routes with simple config should handle HEAD request to magic async chunk: response status 1`] = `200`; - -exports[`Built in routes with simple config should handles GET request to sockjs bundle: console messages 1`] = `[]`; - -exports[`Built in routes with simple config should handles GET request to sockjs bundle: page errors 1`] = `[]`; - -exports[`Built in routes with simple config should handles GET request to sockjs bundle: response headers content-type 1`] = `"application/javascript; charset=UTF-8"`; - -exports[`Built in routes with simple config should handles GET request to sockjs bundle: response status 1`] = `200`; - -exports[`Built in routes with simple config should handles HEAD request to sockjs bundle: console messages 1`] = `[]`; - -exports[`Built in routes with simple config should handles HEAD request to sockjs bundle: page errors 1`] = `[]`; - -exports[`Built in routes with simple config should handles HEAD request to sockjs bundle: response headers content-type 1`] = `"application/javascript; charset=UTF-8"`; - -exports[`Built in routes with simple config should handles HEAD request to sockjs bundle: response status 1`] = `200`; diff --git a/test/e2e/__snapshots__/client-reconnect.test.js.snap.webpack5 b/test/e2e/__snapshots__/client-reconnect.test.js.snap.webpack5 index 6beb3163b8..d043471d44 100644 --- a/test/e2e/__snapshots__/client-reconnect.test.js.snap.webpack5 +++ b/test/e2e/__snapshots__/client-reconnect.test.js.snap.webpack5 @@ -20,10 +20,10 @@ exports[`client.reconnect option specified as number should try to reconnect 2 t "Hey.", "[webpack-dev-server] Disconnected!", "[webpack-dev-server] Trying to reconnect...", - "WebSocket connection to 'ws://localhost:8163/ws' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED", + "WebSocket connection to 'ws://localhost:8161/ws' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED", "[webpack-dev-server] JSHandle@object", "[webpack-dev-server] Trying to reconnect...", - "WebSocket connection to 'ws://localhost:8163/ws' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED", + "WebSocket connection to 'ws://localhost:8161/ws' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED", "[webpack-dev-server] JSHandle@object", ] `; diff --git a/test/e2e/__snapshots__/hot-and-live-reload.test.js.snap.webpack5 b/test/e2e/__snapshots__/hot-and-live-reload.test.js.snap.webpack5 index 729e827490..eb184786fa 100644 --- a/test/e2e/__snapshots__/hot-and-live-reload.test.js.snap.webpack5 +++ b/test/e2e/__snapshots__/hot-and-live-reload.test.js.snap.webpack5 @@ -9,15 +9,6 @@ exports[`hot and live reload should not refresh content when hot and no live rel exports[`hot and live reload should not refresh content when hot and no live reload disabled (default): page errors 1`] = `[]`; -exports[`hot and live reload should not refresh content when hot and no live reload disabled (sockjs): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement disabled, Live Reloading disabled, Progress disabled, Overlay enabled.", - "[webpack-dev-server] App updated. Recompiling...", -] -`; - -exports[`hot and live reload should not refresh content when hot and no live reload disabled (sockjs): page errors 1`] = `[]`; - exports[`hot and live reload should not refresh content when hot and no live reload disabled (ws): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement disabled, Live Reloading disabled, Progress disabled, Overlay enabled.", @@ -97,23 +88,6 @@ exports[`hot and live reload should work and refresh content using hot module re exports[`hot and live reload should work and refresh content using hot module replacement when hot enabled (default): page errors 1`] = `[]`; -exports[`hot and live reload should work and refresh content using hot module replacement when hot enabled (sockjs): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "[webpack-dev-server] App updated. Recompiling...", - "[webpack-dev-server] App hot update...", - "[HMR] Checking for updates on the server...", - "[HMR] Updated modules:", - "[HMR] - ./main.css", - "[HMR] - ../../../node_modules/css-loader/dist/cjs.js!./main.css", - "", - "[HMR] App is up to date.", -] -`; - -exports[`hot and live reload should work and refresh content using hot module replacement when hot enabled (sockjs): page errors 1`] = `[]`; - exports[`hot and live reload should work and refresh content using hot module replacement when hot enabled (ws): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -131,23 +105,6 @@ exports[`hot and live reload should work and refresh content using hot module re exports[`hot and live reload should work and refresh content using hot module replacement when hot enabled (ws): page errors 1`] = `[]`; -exports[`hot and live reload should work and refresh content using hot module replacement when live reload and hot enabled (sockjs): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "[webpack-dev-server] App updated. Recompiling...", - "[webpack-dev-server] App hot update...", - "[HMR] Checking for updates on the server...", - "[HMR] Updated modules:", - "[HMR] - ./main.css", - "[HMR] - ../../../node_modules/css-loader/dist/cjs.js!./main.css", - "", - "[HMR] App is up to date.", -] -`; - -exports[`hot and live reload should work and refresh content using hot module replacement when live reload and hot enabled (sockjs): page errors 1`] = `[]`; - exports[`hot and live reload should work and refresh content using hot module replacement when live reload and hot enabled (ws): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -182,23 +139,6 @@ exports[`hot and live reload should work and refresh content using hot module re exports[`hot and live reload should work and refresh content using hot module replacement when live reload disabled and hot enabled (default): page errors 1`] = `[]`; -exports[`hot and live reload should work and refresh content using hot module replacement when live reload disabled and hot enabled (sockjs): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading disabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "[webpack-dev-server] App updated. Recompiling...", - "[webpack-dev-server] App hot update...", - "[HMR] Checking for updates on the server...", - "[HMR] Updated modules:", - "[HMR] - ./main.css", - "[HMR] - ../../../node_modules/css-loader/dist/cjs.js!./main.css", - "", - "[HMR] App is up to date.", -] -`; - -exports[`hot and live reload should work and refresh content using hot module replacement when live reload disabled and hot enabled (sockjs): page errors 1`] = `[]`; - exports[`hot and live reload should work and refresh content using hot module replacement when live reload disabled and hot enabled (ws): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading disabled, Progress disabled, Overlay enabled.", @@ -233,23 +173,6 @@ exports[`hot and live reload should work and refresh content using hot module re exports[`hot and live reload should work and refresh content using hot module replacement when live reload enabled (default): page errors 1`] = `[]`; -exports[`hot and live reload should work and refresh content using hot module replacement when live reload enabled (sockjs): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "[webpack-dev-server] App updated. Recompiling...", - "[webpack-dev-server] App hot update...", - "[HMR] Checking for updates on the server...", - "[HMR] Updated modules:", - "[HMR] - ./main.css", - "[HMR] - ../../../node_modules/css-loader/dist/cjs.js!./main.css", - "", - "[HMR] App is up to date.", -] -`; - -exports[`hot and live reload should work and refresh content using hot module replacement when live reload enabled (sockjs): page errors 1`] = `[]`; - exports[`hot and live reload should work and refresh content using hot module replacement when live reload enabled (ws): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -295,17 +218,6 @@ exports[`hot and live reload should work and refresh content using live reload ( exports[`hot and live reload should work and refresh content using live reload (default): page errors 1`] = `[]`; -exports[`hot and live reload should work and refresh content using live reload when live reload disabled and hot enabled (sockjs): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement disabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[webpack-dev-server] App updated. Recompiling...", - "[webpack-dev-server] App updated. Reloading...", - "[webpack-dev-server] Server started: Hot Module Replacement disabled, Live Reloading enabled, Progress disabled, Overlay enabled.", -] -`; - -exports[`hot and live reload should work and refresh content using live reload when live reload disabled and hot enabled (sockjs): page errors 1`] = `[]`; - exports[`hot and live reload should work and refresh content using live reload when live reload enabled and hot disabled (ws): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement disabled, Live Reloading enabled, Progress disabled, Overlay enabled.", diff --git a/test/e2e/__snapshots__/ipc.test.js.snap.webpack5 b/test/e2e/__snapshots__/ipc.test.js.snap.webpack5 index 96c5973c2d..bf7ab3e4da 100644 --- a/test/e2e/__snapshots__/ipc.test.js.snap.webpack5 +++ b/test/e2e/__snapshots__/ipc.test.js.snap.webpack5 @@ -1,15 +1,5 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`web socket server URL should work with the "ipc" option using "string" value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "ipc" option using "string" value ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "ipc" option using "string" value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -20,16 +10,6 @@ exports[`web socket server URL should work with the "ipc" option using "string" exports[`web socket server URL should work with the "ipc" option using "string" value ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "ipc" option using "true" value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "ipc" option using "true" value ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "ipc" option using "true" value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", diff --git a/test/e2e/__snapshots__/logging.test.js.snap.webpack5 b/test/e2e/__snapshots__/logging.test.js.snap.webpack5 index bd5c6336ea..4c8cc479f7 100644 --- a/test/e2e/__snapshots__/logging.test.js.snap.webpack5 +++ b/test/e2e/__snapshots__/logging.test.js.snap.webpack5 @@ -1,12 +1,5 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`logging should work and do not log messages about hot and live reloading is enabled (sockjs) 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement disabled, Live Reloading disabled, Progress disabled, Overlay enabled.", - "Hey.", -] -`; - exports[`logging should work and do not log messages about hot and live reloading is enabled (ws) 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement disabled, Live Reloading disabled, Progress disabled, Overlay enabled.", @@ -14,17 +7,6 @@ exports[`logging should work and do not log messages about hot and live reloadin ] `; -exports[`logging should work and log errors by default (sockjs) 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", - "[webpack-dev-server] Errors while compiling. Reload prevented.", - "[webpack-dev-server] ERROR -Error from compilation", -] -`; - exports[`logging should work and log errors by default (ws) 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -36,13 +18,6 @@ Error from compilation", ] `; -exports[`logging should work and log message about live reloading is enabled (sockjs) 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement disabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "Hey.", -] -`; - exports[`logging should work and log message about live reloading is enabled (ws) 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement disabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -50,30 +25,6 @@ exports[`logging should work and log message about live reloading is enabled (ws ] `; -exports[`logging should work and log messages about hot and live reloading is enabled (sockjs) 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`logging should work and log messages about hot and live reloading is enabled (sockjs) 2`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`logging should work and log messages about hot and live reloading is enabled (sockjs) 3`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - exports[`logging should work and log messages about hot and live reloading is enabled (ws) 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -98,14 +49,6 @@ exports[`logging should work and log messages about hot and live reloading is en ] `; -exports[`logging should work and log messages about hot is enabled (sockjs) 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading disabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - exports[`logging should work and log messages about hot is enabled (ws) 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading disabled, Progress disabled, Overlay enabled.", @@ -114,15 +57,6 @@ exports[`logging should work and log messages about hot is enabled (ws) 1`] = ` ] `; -exports[`logging should work and log only error (sockjs) 1`] = ` -[ - "Hey.", - "[webpack-dev-server] Errors while compiling. Reload prevented.", - "[webpack-dev-server] ERROR -Error from compilation", -] -`; - exports[`logging should work and log only error (ws) 1`] = ` [ "Hey.", @@ -132,18 +66,6 @@ Error from compilation", ] `; -exports[`logging should work and log static changes (sockjs) 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", - "[webpack-dev-server] "/test/fixtures/client-config/static/foo.txt" from static directory was changed. Reloading...", - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - exports[`logging should work and log static changes (ws) 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -156,18 +78,6 @@ exports[`logging should work and log static changes (ws) 1`] = ` ] `; -exports[`logging should work and log warning and errors (sockjs) 1`] = ` -[ - "Hey.", - "[webpack-dev-server] Warnings while compiling.", - "[webpack-dev-server] WARNING -Warning from compilation", - "[webpack-dev-server] Errors while compiling. Reload prevented.", - "[webpack-dev-server] ERROR -Error from compilation", -] -`; - exports[`logging should work and log warning and errors (ws) 1`] = ` [ "Hey.", @@ -180,17 +90,6 @@ Error from compilation", ] `; -exports[`logging should work and log warnings by default (sockjs) 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", - "[webpack-dev-server] Warnings while compiling.", - "[webpack-dev-server] WARNING -Warning from compilation", -] -`; - exports[`logging should work and log warnings by default (ws) 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -202,14 +101,6 @@ Warning from compilation", ] `; -exports[`logging should work when the "client.logging" is "info" (sockjs) 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - exports[`logging should work when the "client.logging" is "info" (ws) 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -218,14 +109,6 @@ exports[`logging should work when the "client.logging" is "info" (ws) 1`] = ` ] `; -exports[`logging should work when the "client.logging" is "log" (sockjs) 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - exports[`logging should work when the "client.logging" is "log" (ws) 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -234,26 +117,12 @@ exports[`logging should work when the "client.logging" is "log" (ws) 1`] = ` ] `; -exports[`logging should work when the "client.logging" is "none" (sockjs) 1`] = ` -[ - "Hey.", -] -`; - exports[`logging should work when the "client.logging" is "none" (ws) 1`] = ` [ "Hey.", ] `; -exports[`logging should work when the "client.logging" is "verbose" (sockjs) 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - exports[`logging should work when the "client.logging" is "verbose" (ws) 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", diff --git a/test/e2e/__snapshots__/port.test.js.snap.webpack5 b/test/e2e/__snapshots__/port.test.js.snap.webpack5 index b88dae9b1a..3a5dc33cd7 100644 --- a/test/e2e/__snapshots__/port.test.js.snap.webpack5 +++ b/test/e2e/__snapshots__/port.test.js.snap.webpack5 @@ -20,7 +20,7 @@ exports[`port should work using "0" port : console messages 1`] = ` exports[`port should work using "0" port : page errors 1`] = `[]`; -exports[`port should work using "8161" port : console messages 1`] = ` +exports[`port should work using "8159" port : console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", "[HMR] Waiting for update signal from WDS...", @@ -28,7 +28,7 @@ exports[`port should work using "8161" port : console messages 1`] = ` ] `; -exports[`port should work using "8161" port : console messages 2`] = ` +exports[`port should work using "8159" port : console messages 2`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", "[HMR] Waiting for update signal from WDS...", @@ -36,9 +36,9 @@ exports[`port should work using "8161" port : console messages 2`] = ` ] `; -exports[`port should work using "8161" port : page errors 1`] = `[]`; +exports[`port should work using "8159" port : page errors 1`] = `[]`; -exports[`port should work using "8161" port : page errors 2`] = `[]`; +exports[`port should work using "8159" port : page errors 2`] = `[]`; exports[`port should work using "auto" port : console messages 1`] = ` [ diff --git a/test/e2e/__snapshots__/server-and-client-transport.test.js.snap.webpack5 b/test/e2e/__snapshots__/server-and-client-transport.test.js.snap.webpack5 index f789fc8cdc..a106b87b20 100644 --- a/test/e2e/__snapshots__/server-and-client-transport.test.js.snap.webpack5 +++ b/test/e2e/__snapshots__/server-and-client-transport.test.js.snap.webpack5 @@ -1,33 +1,10 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`server and client transport should throw an error on invalid path to client transport 1`] = `"client.webSocketTransport must be a string denoting a default implementation (e.g. 'sockjs', 'ws') or a full path to a JS file via require.resolve(...) which exports a class "`; +exports[`server and client transport should throw an error on invalid path to client transport 1`] = `"client.webSocketTransport must be a string denoting a default implementation (e.g. 'ws') or a full path to a JS file via require.resolve(...) which exports a class "`; -exports[`server and client transport should throw an error on invalid path to server transport 1`] = `"webSocketServer (webSocketServer.type) must be a string denoting a default implementation (e.g. 'ws', 'sockjs'), a full path to a JS file which exports a class extending BaseServer (webpack-dev-server/lib/servers/BaseServer.js) via require.resolve(...), or the class itself which extends BaseServer"`; +exports[`server and client transport should throw an error on invalid path to server transport 1`] = `"webSocketServer (webSocketServer.type) must be a string denoting a default implementation (e.g. 'ws'), a full path to a JS file which exports a class extending BaseServer (webpack-dev-server/lib/servers/BaseServer.js) via require.resolve(...), or the class itself which extends BaseServer"`; -exports[`server and client transport should throw an error on wrong path 1`] = `"webSocketServer (webSocketServer.type) must be a string denoting a default implementation (e.g. 'ws', 'sockjs'), a full path to a JS file which exports a class extending BaseServer (webpack-dev-server/lib/servers/BaseServer.js) via require.resolve(...), or the class itself which extends BaseServer"`; - -exports[`server and client transport should use "sockjs" transport and "sockjs" web socket server 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", -] -`; - -exports[`server and client transport should use "sockjs" transport, when web socket server is not specify 1`] = `[]`; - -exports[`server and client transport should use "sockjs" web socket server when specify "sockjs" value 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", -] -`; - -exports[`server and client transport should use "sockjs" web socket server when specify "sockjs" value using object 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", -] -`; +exports[`server and client transport should throw an error on wrong path 1`] = `"webSocketServer (webSocketServer.type) must be a string denoting a default implementation (e.g. 'ws'), a full path to a JS file which exports a class extending BaseServer (webpack-dev-server/lib/servers/BaseServer.js) via require.resolve(...), or the class itself which extends BaseServer"`; exports[`server and client transport should use "ws" transport and "ws" web socket server 1`] = ` [ @@ -57,20 +34,6 @@ exports[`server and client transport should use "ws" web socket server when spec ] `; -exports[`server and client transport should use custom transport and "sockjs" web socket server 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "open", - "hot", - "liveReload", - "reconnect", - "overlay", - "hash", - "ok", -] -`; - exports[`server and client transport should use custom web socket server when specify class 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", diff --git a/test/e2e/__snapshots__/web-socket-communication.test.js.snap.webpack5 b/test/e2e/__snapshots__/web-socket-communication.test.js.snap.webpack5 index 267eb3545e..5a31cc7769 100644 --- a/test/e2e/__snapshots__/web-socket-communication.test.js.snap.webpack5 +++ b/test/e2e/__snapshots__/web-socket-communication.test.js.snap.webpack5 @@ -1,17 +1,5 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`web socket communication should work and close web socket client connection when web socket server closed ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", - "[webpack-dev-server] Disconnected!", - "[webpack-dev-server] Trying to reconnect...", -] -`; - -exports[`web socket communication should work and close web socket client connection when web socket server closed ("sockjs"): page errors 1`] = `[]`; - exports[`web socket communication should work and close web socket client connection when web socket server closed ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -24,26 +12,6 @@ exports[`web socket communication should work and close web socket client connec exports[`web socket communication should work and close web socket client connection when web socket server closed ("ws"): page errors 1`] = `[]`; -exports[`web socket communication should work and reconnect when the connection is lost ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", - "[webpack-dev-server] Disconnected!", - "[webpack-dev-server] Trying to reconnect...", - "[webpack-dev-server] App hot update...", - "[HMR] Checking for updates on the server...", - "Failed to load resource: the server responded with a status of 404 (Not Found)", - "[HMR] Cannot find update. Need to do a full reload!", - "[HMR] (Probably because of restarting the webpack-dev-server)", - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket communication should work and reconnect when the connection is lost ("sockjs"): page errors 1`] = `[]`; - exports[`web socket communication should work and reconnect when the connection is lost ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -64,16 +32,6 @@ exports[`web socket communication should work and reconnect when the connection exports[`web socket communication should work and reconnect when the connection is lost ("ws"): page errors 1`] = `[]`; -exports[`web socket communication should work and terminate client that is not alive ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket communication should work and terminate client that is not alive ("sockjs"): page errors 1`] = `[]`; - exports[`web socket communication should work and terminate client that is not alive ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", diff --git a/test/e2e/__snapshots__/web-socket-server-url.test.js.snap.webpack5 b/test/e2e/__snapshots__/web-socket-server-url.test.js.snap.webpack5 index 2640f84902..931f7df51e 100644 --- a/test/e2e/__snapshots__/web-socket-server-url.test.js.snap.webpack5 +++ b/test/e2e/__snapshots__/web-socket-server-url.test.js.snap.webpack5 @@ -1,17 +1,5 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`web socket server URL should not work and output disconnect wrong web socket URL ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", - "Failed to load resource: net::ERR_NAME_NOT_RESOLVED", - "[webpack-dev-server] Disconnected!", -] -`; - -exports[`web socket server URL should not work and output disconnect wrong web socket URL ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should not work and output disconnect wrong web socket URL ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -25,18 +13,6 @@ exports[`web socket server URL should not work and output disconnect wrong web s exports[`web socket server URL should not work and output disconnect wrong web socket URL ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work and throw an error on invalid web socket URL ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", -] -`; - -exports[`web socket server URL should work and throw an error on invalid web socket URL ("sockjs"): page errors 1`] = ` -[ - "The URL's scheme must be either 'http:' or 'https:'. 'unknown:' is not allowed.", -] -`; - exports[`web socket server URL should work and throw an error on invalid web socket URL ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -49,16 +25,6 @@ exports[`web socket server URL should work and throw an error on invalid web soc ] `; -exports[`web socket server URL should work behind proxy, when hostnames are different and ports are different ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work behind proxy, when hostnames are different and ports are different ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work behind proxy, when hostnames are different and ports are different ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -69,16 +35,6 @@ exports[`web socket server URL should work behind proxy, when hostnames are diff exports[`web socket server URL should work behind proxy, when hostnames are different and ports are different ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work behind proxy, when hostnames are different and ports are same ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work behind proxy, when hostnames are different and ports are same ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work behind proxy, when hostnames are different and ports are same ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -89,16 +45,6 @@ exports[`web socket server URL should work behind proxy, when hostnames are diff exports[`web socket server URL should work behind proxy, when hostnames are different and ports are same ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work behind proxy, when hostnames are same and ports are different ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work behind proxy, when hostnames are same and ports are different ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work behind proxy, when hostnames are same and ports are different ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -109,16 +55,6 @@ exports[`web socket server URL should work behind proxy, when hostnames are same exports[`web socket server URL should work behind proxy, when hostnames are same and ports are different ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work behind proxy, when the "host" option is "local-ip" and the "port" option is "auto" ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work behind proxy, when the "host" option is "local-ip" and the "port" option is "auto" ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work behind proxy, when the "host" option is "local-ip" and the "port" option is "auto" ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -129,16 +65,6 @@ exports[`web socket server URL should work behind proxy, when the "host" option exports[`web socket server URL should work behind proxy, when the "host" option is "local-ip" and the "port" option is "auto" ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work when "host" option is "local-ip" ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work when "host" option is "local-ip" ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work when "host" option is "local-ip" ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -149,16 +75,6 @@ exports[`web socket server URL should work when "host" option is "local-ip" ("ws exports[`web socket server URL should work when "host" option is "local-ip" ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work when "host" option is "local-ipv4" ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work when "host" option is "local-ipv4" ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work when "host" option is "local-ipv4" ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -169,16 +85,6 @@ exports[`web socket server URL should work when "host" option is "local-ipv4" (" exports[`web socket server URL should work when "host" option is "local-ipv4" ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work when "host" option is IPv4 ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work when "host" option is IPv4 ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work when "host" option is IPv4 ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -189,16 +95,6 @@ exports[`web socket server URL should work when "host" option is IPv4 ("ws"): co exports[`web socket server URL should work when "host" option is IPv4 ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work when "port" option is "auto" ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work when "port" option is "auto" ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work when "port" option is "auto" ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -209,16 +105,6 @@ exports[`web socket server URL should work when "port" option is "auto" ("ws"): exports[`web socket server URL should work when "port" option is "auto" ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with "client.webSocketURL.*" options ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with "client.webSocketURL.*" options ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with "client.webSocketURL.*" options ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -229,16 +115,6 @@ exports[`web socket server URL should work with "client.webSocketURL.*" options exports[`web socket server URL should work with "client.webSocketURL.*" options ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with "client.webSocketURL.port" and "webSocketServer.options.port" options as string ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with "client.webSocketURL.port" and "webSocketServer.options.port" options as string ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with "client.webSocketURL.port" and "webSocketServer.options.port" options as string ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -249,16 +125,6 @@ exports[`web socket server URL should work with "client.webSocketURL.port" and " exports[`web socket server URL should work with "client.webSocketURL.port" and "webSocketServer.options.port" options as string ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with "server: 'https'" option ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with "server: 'https'" option ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with "server: 'https'" option ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -269,16 +135,6 @@ exports[`web socket server URL should work with "server: 'https'" option ("ws"): exports[`web socket server URL should work with "server: 'https'" option ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with default "/ws" value of the "client.webSocketURL.pathname" option ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with default "/ws" value of the "client.webSocketURL.pathname" option ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with default "/ws" value of the "client.webSocketURL.pathname" option ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -289,16 +145,6 @@ exports[`web socket server URL should work with default "/ws" value of the "clie exports[`web socket server URL should work with default "/ws" value of the "client.webSocketURL.pathname" option ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL" option as "string" ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL" option as "string" ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL" option as "string" ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -309,16 +155,6 @@ exports[`web socket server URL should work with the "client.webSocketURL" option exports[`web socket server URL should work with the "client.webSocketURL" option as "string" ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.host" option ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.host" option ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL.host" option ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -329,16 +165,6 @@ exports[`web socket server URL should work with the "client.webSocketURL.host" o exports[`web socket server URL should work with the "client.webSocketURL.host" option ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.host" option using "0.0.0.0" value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.host" option using "0.0.0.0" value ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL.host" option using "0.0.0.0" value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -349,16 +175,6 @@ exports[`web socket server URL should work with the "client.webSocketURL.host" o exports[`web socket server URL should work with the "client.webSocketURL.host" option using "0.0.0.0" value ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.password" option ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.password" option ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL.password" option ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -369,7 +185,7 @@ exports[`web socket server URL should work with the "client.webSocketURL.passwor exports[`web socket server URL should work with the "client.webSocketURL.password" option ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option ("sockjs"): console messages 1`] = ` +exports[`web socket server URL should work with the "client.webSocketURL.pathname" option ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", "[HMR] Waiting for update signal from WDS...", @@ -377,9 +193,7 @@ exports[`web socket server URL should work with the "client.webSocketURL.pathnam ] `; -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option ("sockjs"): page errors 1`] = `[]`; - -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option ("ws"): console messages 1`] = ` +exports[`web socket server URL should work with the "client.webSocketURL.pathname" option ("ws"): console messages 2`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", "[HMR] Waiting for update signal from WDS...", @@ -389,15 +203,7 @@ exports[`web socket server URL should work with the "client.webSocketURL.pathnam exports[`web socket server URL should work with the "client.webSocketURL.pathname" option ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" ("sockjs"): page errors 1`] = `[]`; +exports[`web socket server URL should work with the "client.webSocketURL.pathname" option ("ws"): page errors 2`] = `[]`; exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" ("ws"): console messages 1`] = ` [ @@ -409,16 +215,6 @@ exports[`web socket server URL should work with the "client.webSocketURL.pathnam exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" ending with slash ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" ending with slash ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" ending with slash ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -429,16 +225,6 @@ exports[`web socket server URL should work with the "client.webSocketURL.pathnam exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" ending with slash ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" ending without slash ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" ending without slash ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" ending without slash ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -449,16 +235,6 @@ exports[`web socket server URL should work with the "client.webSocketURL.pathnam exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" ending without slash ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" using empty value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" using empty value ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" using empty value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -469,36 +245,6 @@ exports[`web socket server URL should work with the "client.webSocketURL.pathnam exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" using empty value ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "prefix" for compatibility with "sockjs" ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "prefix" for compatibility with "sockjs" ("sockjs"): page errors 1`] = `[]`; - -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "prefix" for compatibility with "sockjs" ("ws"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.pathname" option and the custom web socket server "prefix" for compatibility with "sockjs" ("ws"): page errors 1`] = `[]`; - -exports[`web socket server URL should work with the "client.webSocketURL.port" option ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.port" option ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL.port" option ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -509,16 +255,6 @@ exports[`web socket server URL should work with the "client.webSocketURL.port" o exports[`web socket server URL should work with the "client.webSocketURL.port" option ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.port" option as string ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.port" option as string ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL.port" option as string ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -529,16 +265,6 @@ exports[`web socket server URL should work with the "client.webSocketURL.port" o exports[`web socket server URL should work with the "client.webSocketURL.port" option as string ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.port" option using "0" value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.port" option using "0" value ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL.port" option using "0" value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -549,16 +275,6 @@ exports[`web socket server URL should work with the "client.webSocketURL.port" o exports[`web socket server URL should work with the "client.webSocketURL.port" option using "0" value ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.protocol" option ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.protocol" option ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL.protocol" option ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -569,16 +285,6 @@ exports[`web socket server URL should work with the "client.webSocketURL.protoco exports[`web socket server URL should work with the "client.webSocketURL.protocol" option ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.protocol" option using "auto:" value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.protocol" option using "auto:" value ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL.protocol" option using "auto:" value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -589,16 +295,6 @@ exports[`web socket server URL should work with the "client.webSocketURL.protoco exports[`web socket server URL should work with the "client.webSocketURL.protocol" option using "auto:" value ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.protocol" option using "http:" value and convert to "ws:" ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.protocol" option using "http:" value and convert to "ws:" ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL.protocol" option using "http:" value and convert to "ws:" ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -609,16 +305,6 @@ exports[`web socket server URL should work with the "client.webSocketURL.protoco exports[`web socket server URL should work with the "client.webSocketURL.protocol" option using "http:" value and convert to "ws:" ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.username" and "client.webSocketURL.password" option ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.username" and "client.webSocketURL.password" option ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL.username" and "client.webSocketURL.password" option ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -629,16 +315,6 @@ exports[`web socket server URL should work with the "client.webSocketURL.usernam exports[`web socket server URL should work with the "client.webSocketURL.username" and "client.webSocketURL.password" option ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the "client.webSocketURL.username" option ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the "client.webSocketURL.username" option ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the "client.webSocketURL.username" option ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -649,16 +325,6 @@ exports[`web socket server URL should work with the "client.webSocketURL.usernam exports[`web socket server URL should work with the "client.webSocketURL.username" option ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the custom web socket server "path" ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the custom web socket server "path" ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the custom web socket server "path" ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -669,16 +335,6 @@ exports[`web socket server URL should work with the custom web socket server "pa exports[`web socket server URL should work with the custom web socket server "path" ("ws"): page errors 1`] = `[]`; -exports[`web socket server URL should work with the custom web socket server "path" using empty value ("sockjs"): console messages 1`] = ` -[ - "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`web socket server URL should work with the custom web socket server "path" using empty value ("sockjs"): page errors 1`] = `[]`; - exports[`web socket server URL should work with the custom web socket server "path" using empty value ("ws"): console messages 1`] = ` [ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", diff --git a/test/e2e/allowed-hosts.test.js b/test/e2e/allowed-hosts.test.js index 163a24f265..3841e31156 100644 --- a/test/e2e/allowed-hosts.test.js +++ b/test/e2e/allowed-hosts.test.js @@ -8,7 +8,7 @@ const config = require("../fixtures/client-config/webpack.config"); const runBrowser = require("../helpers/run-browser"); const [port1, port2] = require("../ports-map")["allowed-hosts"]; -const webSocketServers = ["ws", "sockjs"]; +const webSocketServers = ["ws"]; describe("allowed hosts", () => { for (const webSocketServer of webSocketServers) { diff --git a/test/e2e/built-in-routes.test.js b/test/e2e/built-in-routes.test.js index faab99f224..a0af821a2a 100644 --- a/test/e2e/built-in-routes.test.js +++ b/test/e2e/built-in-routes.test.js @@ -33,69 +33,6 @@ describe("Built in routes", () => { await server.stop(); }); - it("should handles GET request to sockjs bundle", async () => { - page - .on("console", (message) => { - consoleMessages.push(message); - }) - .on("pageerror", (error) => { - pageErrors.push(error); - }); - - const response = await page.goto( - `http://localhost:${port}/__webpack_dev_server__/sockjs.bundle.js`, - { - waitUntil: "networkidle0", - }, - ); - - expect(response.headers()["content-type"]).toMatchSnapshot( - "response headers content-type", - ); - - expect(response.status()).toMatchSnapshot("response status"); - - expect(consoleMessages.map((message) => message.text())).toMatchSnapshot( - "console messages", - ); - - expect(pageErrors).toMatchSnapshot("page errors"); - }); - - it("should handles HEAD request to sockjs bundle", async () => { - page - .on("console", (message) => { - consoleMessages.push(message); - }) - .on("pageerror", (error) => { - pageErrors.push(error); - }) - .on("request", (interceptedRequest) => { - if (interceptedRequest.isInterceptResolutionHandled()) return; - - interceptedRequest.continue({ method: "HEAD" }, 10); - }); - - const response = await page.goto( - `http://localhost:${port}/__webpack_dev_server__/sockjs.bundle.js`, - { - waitUntil: "networkidle0", - }, - ); - - expect(response.headers()["content-type"]).toMatchSnapshot( - "response headers content-type", - ); - - expect(response.status()).toMatchSnapshot("response status"); - - expect(consoleMessages.map((message) => message.text())).toMatchSnapshot( - "console messages", - ); - - expect(pageErrors).toMatchSnapshot("page errors"); - }); - it("should handle GET request to invalidate endpoint", async () => { page .on("console", (message) => { diff --git a/test/e2e/client.test.js b/test/e2e/client.test.js index 335ca39648..96c9d1536b 100644 --- a/test/e2e/client.test.js +++ b/test/e2e/client.test.js @@ -21,9 +21,9 @@ describe("client option", () => { server = new Server( { client: { - webSocketTransport: "sockjs", + webSocketTransport: "ws", }, - webSocketServer: "sockjs", + webSocketServer: "ws", port, }, compiler, @@ -82,10 +82,10 @@ describe("client option", () => { server = new Server( { client: { - webSocketTransport: "sockjs", + webSocketTransport: "ws", }, webSocketServer: { - type: "sockjs", + type: "ws", options: { host: "localhost", port, @@ -248,14 +248,6 @@ describe("client option", () => { describe("webSocketTransport", () => { const clientModes = [ - { - title: 'as a string ("sockjs")', - client: { - webSocketTransport: "sockjs", - }, - webSocketServer: "sockjs", - shouldThrow: false, - }, { title: 'as a string ("ws")', client: { @@ -264,16 +256,6 @@ describe("client option", () => { webSocketServer: "ws", shouldThrow: false, }, - { - title: 'as a path ("sockjs")', - client: { - webSocketTransport: require.resolve( - "../../client-src/clients/SockJSClient", - ), - }, - webSocketServer: "sockjs", - shouldThrow: false, - }, { title: 'as a path ("ws")', client: { @@ -284,14 +266,6 @@ describe("client option", () => { webSocketServer: "ws", shouldThrow: false, }, - { - title: "as a nonexistent path (sockjs)", - client: { - webSocketTransport: "/bad/path/to/implementation", - }, - webSocketServer: "sockjs", - shouldThrow: true, - }, { title: "as a nonexistent path (ws)", client: { diff --git a/test/e2e/hot-and-live-reload.test.js b/test/e2e/hot-and-live-reload.test.js index 32e1f9dcb3..9778b2cd5f 100644 --- a/test/e2e/hot-and-live-reload.test.js +++ b/test/e2e/hot-and-live-reload.test.js @@ -6,7 +6,6 @@ const path = require("node:path"); const fs = require("graceful-fs"); -const SockJS = require("sockjs-client"); const webpack = require("webpack"); const WebSocket = require("ws"); const Server = require("../../lib/Server"); @@ -25,7 +24,6 @@ const cssFilePath = path.resolve( const INVALID_MESSAGE = "[webpack-dev-server] App updated. Recompiling..."; describe("hot and live reload", () => { - // "sockjs" client cannot add additional headers const modes = [ { title: "should work and refresh content using hot module replacement", @@ -133,70 +131,6 @@ describe("hot and live reload", () => { hot: true, }, }, - // "sockjs" web socket serve - { - title: - "should work and refresh content using hot module replacement when hot enabled", - options: { - allowedHosts: "all", - - webSocketServer: "sockjs", - hot: true, - }, - }, - { - title: - "should work and refresh content using hot module replacement when live reload enabled", - options: { - allowedHosts: "all", - - webSocketServer: "sockjs", - liveReload: true, - }, - }, - { - title: "should not refresh content when hot and no live reload disabled", - options: { - allowedHosts: "all", - - webSocketServer: "sockjs", - hot: false, - liveReload: false, - }, - }, - { - title: - "should work and refresh content using hot module replacement when live reload disabled and hot enabled", - options: { - allowedHosts: "all", - - webSocketServer: "sockjs", - liveReload: false, - hot: true, - }, - }, - { - title: - "should work and refresh content using live reload when live reload disabled and hot enabled", - options: { - allowedHosts: "all", - - webSocketServer: "sockjs", - liveReload: true, - hot: false, - }, - }, - { - title: - "should work and refresh content using hot module replacement when live reload and hot enabled", - options: { - allowedHosts: "all", - - webSocketServer: "sockjs", - liveReload: true, - hot: true, - }, - }, { title: 'should work and allow to disable hot module replacement using the "webpack-dev-server-hot=false"', @@ -347,89 +281,44 @@ describe("hot and live reload", () => { testDevServerOptions.webSocketServer !== false; await new Promise((resolve) => { - const webSocketTransport = - typeof testDevServerOptions.webSocketServer !== "undefined" && - testDevServerOptions.webSocketServer !== false - ? testDevServerOptions.webSocketServer - : "ws"; - - if (webSocketTransport === "ws") { - const ws = new WebSocket( - `ws://localhost:${devServerOptions.port}/ws`, - { - headers: { - host: `localhost:${devServerOptions.port}`, - origin: `http://localhost:${devServerOptions.port}`, - }, - }, - ); - - let opened = false; - let received = false; - let errored = false; - - ws.on("error", (_error) => { - errored = true; - - ws.close(); - }); - - ws.on("open", () => { - opened = true; - }); - - ws.on("message", (data) => { - const message = JSON.parse(data); - - if (message.type === "ok") { - received = true; + const ws = new WebSocket(`ws://localhost:${devServerOptions.port}/ws`, { + headers: { + host: `localhost:${devServerOptions.port}`, + origin: `http://localhost:${devServerOptions.port}`, + }, + }); - ws.close(); - } - }); + let opened = false; + let received = false; + let errored = false; - ws.on("close", () => { - if (opened && received && !errored) { - resolve(); - } else if (!webSocketServerLaunched && errored) { - resolve(); - } - }); - } else { - const sockjs = new SockJS( - `http://localhost:${devServerOptions.port}/ws`, - ); + ws.on("error", (_error) => { + errored = true; - let opened = false; - let received = false; - let errored = false; - - sockjs.onerror = () => { - errored = true; - }; + ws.close(); + }); - sockjs.onopen = () => { - opened = true; - }; + ws.on("open", () => { + opened = true; + }); - sockjs.onmessage = ({ data }) => { - const message = JSON.parse(data); + ws.on("message", (data) => { + const message = JSON.parse(data); - if (message.type === "ok") { - received = true; + if (message.type === "ok") { + received = true; - sockjs.close(); - } - }; + ws.close(); + } + }); - sockjs.onclose = (event) => { - if (opened && received && !errored) { - resolve(); - } else if (event && event.reason === "Cannot connect to server") { - resolve(); - } - }; - } + ws.on("close", () => { + if (opened && received && !errored) { + resolve(); + } else if (!webSocketServerLaunched && errored) { + resolve(); + } + }); }); const launched = await runBrowser(); diff --git a/test/e2e/ipc.test.js b/test/e2e/ipc.test.js index 735b0e652f..b34e45bbe9 100644 --- a/test/e2e/ipc.test.js +++ b/test/e2e/ipc.test.js @@ -12,11 +12,11 @@ const runBrowser = require("../helpers/run-browser"); const sessionSubscribe = require("../helpers/session-subscribe"); const port1 = require("../ports-map").ipc; -const webSocketServers = ["ws", "sockjs"]; +const webSocketServers = ["ws"]; describe("web socket server URL", () => { for (const webSocketServer of webSocketServers) { - const websocketURLProtocol = webSocketServer === "ws" ? "ws" : "http"; + const websocketURLProtocol = webSocketServer; it(`should work with the "ipc" option using "true" value ("${webSocketServer}")`, async () => { const devServerHost = "localhost"; @@ -72,27 +72,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://${proxyHost}:${proxyPort}/`, { waitUntil: "networkidle0", @@ -174,27 +166,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://${proxyHost}:${proxyPort}/`, { waitUntil: "networkidle0", @@ -294,27 +278,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://${proxyHost}:${proxyPort}/`, { waitUntil: "networkidle0", diff --git a/test/e2e/logging.test.js b/test/e2e/logging.test.js index b00d2fa783..9ba530ba3d 100644 --- a/test/e2e/logging.test.js +++ b/test/e2e/logging.test.js @@ -10,10 +10,7 @@ const runBrowser = require("../helpers/run-browser"); const port = require("../ports-map").logging; describe("logging", () => { - const webSocketServers = [ - { webSocketServer: "ws" }, - { webSocketServer: "sockjs" }, - ]; + const webSocketServers = [{ webSocketServer: "ws" }]; const cases = [ { diff --git a/test/e2e/server-and-client-transport.test.js b/test/e2e/server-and-client-transport.test.js index 763a4be353..b8dc4ad79d 100644 --- a/test/e2e/server-and-client-transport.test.js +++ b/test/e2e/server-and-client-transport.test.js @@ -3,9 +3,7 @@ const webpack = require("webpack"); const Server = require("../../lib/Server"); const WebsocketServer = require("../../lib/servers/WebsocketServer"); -const customConfig = require("../fixtures/provide-plugin-custom/webpack.config"); const defaultConfig = require("../fixtures/provide-plugin-default/webpack.config"); -const sockjsConfig = require("../fixtures/provide-plugin-sockjs-config/webpack.config"); const wsConfig = require("../fixtures/provide-plugin-ws-config/webpack.config"); const runBrowser = require("../helpers/run-browser"); const port = require("../ports-map")["server-and-client-transport"]; @@ -123,82 +121,6 @@ describe("server and client transport", () => { } }); - it('should use "sockjs" web socket server when specify "sockjs" value', async () => { - const compiler = webpack(sockjsConfig); - const devServerOptions = { - port, - webSocketServer: "sockjs", - }; - const server = new Server(devServerOptions, compiler); - - await server.start(); - - const { page, browser } = await runBrowser(); - - try { - const consoleMessages = []; - - page.on("console", (message) => { - consoleMessages.push(message); - }); - - await page.goto(`http://localhost:${port}/`, { - waitUntil: "networkidle0", - }); - - const isCorrectTransport = await page.evaluate( - () => globalThis.injectedClient === globalThis.expectedClient, - ); - - expect(isCorrectTransport).toBe(true); - expect( - consoleMessages.map((message) => message.text()), - ).toMatchSnapshot(); - } finally { - await browser.close(); - await server.stop(); - } - }); - - it('should use "sockjs" web socket server when specify "sockjs" value using object', async () => { - const compiler = webpack(sockjsConfig); - const devServerOptions = { - port, - webSocketServer: { - type: "sockjs", - }, - }; - const server = new Server(devServerOptions, compiler); - - await server.start(); - - const { page, browser } = await runBrowser(); - - try { - const consoleMessages = []; - - page.on("console", (message) => { - consoleMessages.push(message); - }); - - await page.goto(`http://localhost:${port}/`, { - waitUntil: "networkidle0", - }); - - const isCorrectTransport = await page.evaluate( - () => globalThis.injectedClient === globalThis.expectedClient, - ); - - expect(isCorrectTransport).toBe(true); - expect( - consoleMessages.map((message) => message.text()), - ).toMatchSnapshot(); - } finally { - await browser.close(); - await server.stop(); - } - }); - it("should use custom web socket server when specify class", async () => { const compiler = webpack(defaultConfig); const devServerOptions = { @@ -384,45 +306,6 @@ describe("server and client transport", () => { } }); - it('should use "sockjs" transport, when web socket server is not specify', async () => { - const compiler = webpack(sockjsConfig); - const devServerOptions = { - port, - client: { - webSocketTransport: "sockjs", - }, - }; - const server = new Server(devServerOptions, compiler); - - await server.start(); - - const { page, browser } = await runBrowser(); - - try { - const consoleMessages = []; - - page.on("console", (message) => { - consoleMessages.push(message); - }); - - await page.goto(`http://localhost:${port}/main.js`, { - waitUntil: "networkidle0", - }); - - const isCorrectTransport = await page.evaluate( - () => globalThis.injectedClient === globalThis.expectedClient, - ); - - expect(isCorrectTransport).toBe(true); - expect( - consoleMessages.map((message) => message.text()), - ).toMatchSnapshot(); - } finally { - await browser.close(); - await server.stop(); - } - }); - it('should use "ws" transport, when web socket server is not specify', async () => { const compiler = webpack(wsConfig); const devServerOptions = { @@ -462,46 +345,6 @@ describe("server and client transport", () => { } }); - it('should use "sockjs" transport and "sockjs" web socket server', async () => { - const compiler = webpack(sockjsConfig); - const devServerOptions = { - port, - client: { - webSocketTransport: "sockjs", - }, - webSocketServer: "sockjs", - }; - const server = new Server(devServerOptions, compiler); - - await server.start(); - - const { page, browser } = await runBrowser(); - - try { - const consoleMessages = []; - - page.on("console", (message) => { - consoleMessages.push(message); - }); - - await page.goto(`http://localhost:${port}/`, { - waitUntil: "networkidle0", - }); - - const isCorrectTransport = await page.evaluate( - () => globalThis.injectedClient === globalThis.expectedClient, - ); - - expect(isCorrectTransport).toBe(true); - expect( - consoleMessages.map((message) => message.text()), - ).toMatchSnapshot(); - } finally { - await browser.close(); - await server.stop(); - } - }); - it('should use "ws" transport and "ws" web socket server', async () => { const compiler = webpack(wsConfig); const devServerOptions = { @@ -542,48 +385,6 @@ describe("server and client transport", () => { } }); - it('should use custom transport and "sockjs" web socket server', async () => { - const compiler = webpack(customConfig); - const devServerOptions = { - port, - client: { - webSocketTransport: require.resolve( - "../fixtures/custom-client/CustomSockJSClient", - ), - }, - webSocketServer: "sockjs", - }; - const server = new Server(devServerOptions, compiler); - - await server.start(); - - const { page, browser } = await runBrowser(); - - try { - const consoleMessages = []; - - page.on("console", (message) => { - consoleMessages.push(message); - }); - - await page.goto(`http://localhost:${port}/`, { - waitUntil: "networkidle0", - }); - - const isCorrectTransport = await page.evaluate( - () => globalThis.injectedClient === globalThis.expectedClient, - ); - - expect(isCorrectTransport).toBe(true); - expect( - consoleMessages.map((message) => message.text()), - ).toMatchSnapshot(); - } finally { - await browser.close(); - await server.stop(); - } - }); - it("should throw an error on invalid path to server transport", async () => { const compiler = webpack(defaultConfig); const devServerOptions = { diff --git a/test/e2e/web-socket-communication.test.js b/test/e2e/web-socket-communication.test.js index 8af3b3678a..d071576eff 100644 --- a/test/e2e/web-socket-communication.test.js +++ b/test/e2e/web-socket-communication.test.js @@ -9,7 +9,7 @@ const runBrowser = require("../helpers/run-browser"); const port = require("../ports-map")["web-socket-communication"]; describe("web socket communication", () => { - const webSocketServers = ["ws", "sockjs"]; + const webSocketServers = ["ws"]; for (const websocketServer of webSocketServers) { it(`should work and close web socket client connection when web socket server closed ("${websocketServer}")`, async () => { diff --git a/test/e2e/web-socket-server-url.test.js b/test/e2e/web-socket-server-url.test.js index 24147d0ba2..df02ca835e 100644 --- a/test/e2e/web-socket-server-url.test.js +++ b/test/e2e/web-socket-server-url.test.js @@ -9,11 +9,11 @@ const runBrowser = require("../helpers/run-browser"); const sessionSubscribe = require("../helpers/session-subscribe"); const [port1, port2] = require("../ports-map")["web-socket-server-url"]; -const webSocketServers = ["ws", "sockjs"]; +const webSocketServers = ["ws"]; describe("web socket server URL", () => { for (const webSocketServer of webSocketServers) { - const websocketURLProtocol = webSocketServer === "ws" ? "ws" : "http"; + const websocketURLProtocol = webSocketServer; it(`should work behind proxy, when hostnames are same and ports are different ("${webSocketServer}")`, async () => { const devServerHost = "127.0.0.1"; @@ -69,27 +69,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://${proxyHost}:${proxyPort}/`, { waitUntil: "networkidle0", @@ -164,27 +156,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://${proxyHost}:${proxyPort}/`, { waitUntil: "networkidle0", @@ -265,27 +249,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://${proxyHost}:${proxyPort}/`, { waitUntil: "networkidle0", }); @@ -365,27 +341,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://${proxyHost}:${proxyPort}/`, { waitUntil: "networkidle0", @@ -443,27 +411,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://localhost:${port1}/`, { waitUntil: "networkidle0", @@ -517,27 +477,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://localhost:${port1}/`, { waitUntil: "networkidle0", @@ -591,27 +543,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://localhost:${port1}/`, { waitUntil: "networkidle0", @@ -665,27 +609,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", @@ -739,27 +675,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", }); @@ -812,27 +740,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", @@ -886,27 +806,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", @@ -934,15 +846,14 @@ describe("web socket server URL", () => { type: webSocketServer, options: { host: "0.0.0.0", - // "sockjs" doesn't support external server - port: webSocketServer === "sockjs" ? `${port1}` : `${port2}`, + port: `${port2}`, }, }, port: port1, host: "0.0.0.0", client: { webSocketURL: { - port: webSocketServer === "sockjs" ? `${port1}` : `${port2}`, + port: `${port2}`, }, }, allowedHosts: "all", @@ -967,27 +878,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", @@ -996,9 +899,7 @@ describe("web socket server URL", () => { const [webSocketRequest] = webSocketRequests; expect(webSocketRequest.url).toContain( - webSocketServer === "sockjs" - ? `${websocketURLProtocol}://127.0.0.1:${port1}/ws` - : `${websocketURLProtocol}://127.0.0.1:${port2}/ws`, + `${websocketURLProtocol}://127.0.0.1:${port2}/ws`, ); expect( consoleMessages.map((message) => message.text()), @@ -1043,27 +944,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", }); @@ -1116,27 +1009,18 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); - - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + const session = await page.target().createCDPSession(); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", @@ -1185,27 +1069,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", @@ -1259,27 +1135,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", }); @@ -1303,13 +1171,10 @@ describe("web socket server URL", () => { const compiler = webpack(config); const devServerOptions = { client: { - webSocketURL: - webSocketServer === "ws" - ? { - username: "foo", - password: "chuntaro", - } - : {}, + webSocketURL: { + username: "foo", + password: "chuntaro", + }, }, webSocketServer, port: port1, @@ -1336,27 +1201,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", }); @@ -1364,10 +1221,7 @@ describe("web socket server URL", () => { const [webSocketRequest] = webSocketRequests; expect(webSocketRequest.url).toContain( - // "sockjs" has bug with parsing URL - webSocketServer === "ws" - ? `${websocketURLProtocol}://foo:chuntaro@127.0.0.1:${port1}/ws` - : `${websocketURLProtocol}://127.0.0.1:${port1}/ws`, + `${websocketURLProtocol}://foo:chuntaro@127.0.0.1:${port1}/ws`, ); expect( consoleMessages.map((message) => message.text()), @@ -1413,27 +1267,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", @@ -1487,27 +1333,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/custom-ws\/foo\/bar/.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", @@ -1535,7 +1373,7 @@ describe("web socket server URL", () => { webSocketServer: { type: webSocketServer, options: { - path: webSocketServer === "ws" ? "" : "/custom-ws", + path: "", }, }, port: port1, @@ -1562,27 +1400,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/custom-ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", @@ -1591,9 +1421,7 @@ describe("web socket server URL", () => { const [webSocketRequest] = webSocketRequests; expect(webSocketRequest.url).toContain( - webSocketServer === "ws" - ? `${websocketURLProtocol}://127.0.0.1:${port1}` - : `${websocketURLProtocol}://127.0.0.1:${port1}/custom-ws`, + `${websocketURLProtocol}://127.0.0.1:${port1}`, ); expect( consoleMessages.map((message) => message.text()), @@ -1643,27 +1471,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/custom-ws\/foo\/bar/.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", @@ -1722,27 +1542,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/custom-ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", @@ -1763,19 +1575,18 @@ describe("web socket server URL", () => { } }); - // Only works for "ws" server, "sockjs" adds "/" be default, because need do requests like "/custom-ws/info?t=1624462615772" it(`should work with the "client.webSocketURL.pathname" option and the custom web socket server "path" ending with slash ("${webSocketServer}")`, async () => { const compiler = webpack(config); const devServerOptions = { client: { webSocketURL: { - pathname: webSocketServer === "ws" ? "/custom-ws/" : "/custom-ws", + pathname: "/custom-ws/", }, }, webSocketServer: { type: webSocketServer, options: { - path: webSocketServer === "ws" ? "/custom-ws/" : "/custom-ws", + path: "/custom-ws/", }, }, port: port1, @@ -1802,27 +1613,20 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); + + sessionSubscribe(session); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/custom-ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", }); @@ -1848,13 +1652,13 @@ describe("web socket server URL", () => { const devServerOptions = { client: { webSocketURL: { - pathname: webSocketServer === "ws" ? "" : "/custom-ws", + pathname: "", }, }, webSocketServer: { type: webSocketServer, options: { - path: webSocketServer === "ws" ? "" : "/custom-ws", + path: "", }, }, port: port1, @@ -1881,27 +1685,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/custom-ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", @@ -1910,9 +1706,7 @@ describe("web socket server URL", () => { const [webSocketRequest] = webSocketRequests; expect(webSocketRequest.url).toContain( - webSocketServer === "ws" - ? `${websocketURLProtocol}://127.0.0.1:${port1}` - : `${websocketURLProtocol}://127.0.0.1:${port1}/custom-ws`, + `${websocketURLProtocol}://127.0.0.1:${port1}`, ); expect( consoleMessages.map((message) => message.text()), @@ -1924,8 +1718,7 @@ describe("web socket server URL", () => { } }); - // Only works for "sockjs" server - it(`should work with the "client.webSocketURL.pathname" option and the custom web socket server "prefix" for compatibility with "sockjs" ("${webSocketServer}")`, async () => { + it(`should work with the "client.webSocketURL.pathname" option ("${webSocketServer}")`, async () => { const compiler = webpack(config); const devServerOptions = { client: { @@ -1935,10 +1728,7 @@ describe("web socket server URL", () => { }, webSocketServer: { type: webSocketServer, - options: - webSocketServer === "ws" - ? { path: "/custom-ws" } - : { prefix: "/custom-ws" }, + options: { path: "/custom-ws" }, }, port: port1, host: "0.0.0.0", @@ -1964,27 +1754,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/custom-ws/.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", @@ -2033,27 +1815,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://${hostname}:${port1}/`, { waitUntil: "networkidle0", }); @@ -2101,27 +1875,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://${hostname}:${port1}/`, { waitUntil: "networkidle0", @@ -2170,27 +1936,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://${hostname}:${port1}/`, { waitUntil: "networkidle0", }); @@ -2238,27 +1996,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`https://${hostname}:${port1}/`, { waitUntil: "networkidle0", @@ -2266,15 +2016,7 @@ describe("web socket server URL", () => { const [webSocketRequest] = webSocketRequests; - if (webSocketServer === "ws") { - expect(webSocketRequest.url).toContain( - `wss://${hostname}:${port1}/ws`, - ); - } else { - expect(webSocketRequest.url).toContain( - `https://${hostname}:${port1}/ws`, - ); - } + expect(webSocketRequest.url).toContain(`wss://${hostname}:${port1}/ws`); expect( consoleMessages.map((message) => message.text()), @@ -2318,27 +2060,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`https://${hostname}:${port1}/`, { waitUntil: "networkidle0", @@ -2347,15 +2081,9 @@ describe("web socket server URL", () => { const [webSocketRequest] = webSocketRequests; /* eslint-disable jest/no-standalone-expect */ - if (webSocketServer === "ws") { - expect(webSocketRequest.url).toContain( - `wss://${hostname}:${port1}/ws`, - ); - } else { - expect(webSocketRequest.url).toContain( - `https://${hostname}:${port1}/ws`, - ); - } + expect(webSocketRequest.url).toContain( + `wss://${hostname}:${port1}/ws`, + ); expect(consoleMessages.map((message) => message.text())).toEqual([ "[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -2403,27 +2131,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${resolvedFreePort}/`, { waitUntil: "networkidle0", @@ -2482,27 +2202,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", @@ -2554,27 +2266,19 @@ describe("web socket server URL", () => { const webSocketRequests = []; - if (webSocketServer === "ws") { - const session = await page.target().createCDPSession(); + const session = await page.target().createCDPSession(); - session.on("Network.webSocketCreated", (test) => { - webSocketRequests.push(test); - }); + session.on("Network.webSocketCreated", (test) => { + webSocketRequests.push(test); + }); - await session.send("Target.setAutoAttach", { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); + await session.send("Target.setAutoAttach", { + autoAttach: true, + flatten: true, + waitForDebuggerOnStart: true, + }); - sessionSubscribe(session); - } else { - page.on("request", (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } + sessionSubscribe(session); await page.goto(`http://127.0.0.1:${port1}/`, { waitUntil: "networkidle0", diff --git a/test/fixtures/custom-client/CustomSockJSClient.js b/test/fixtures/custom-client/CustomWebSocketClient.js similarity index 60% rename from test/fixtures/custom-client/CustomSockJSClient.js rename to test/fixtures/custom-client/CustomWebSocketClient.js index e4f6c54de0..3dae3c241e 100644 --- a/test/fixtures/custom-client/CustomSockJSClient.js +++ b/test/fixtures/custom-client/CustomWebSocketClient.js @@ -2,22 +2,23 @@ const SockJS = require("sockjs-client/dist/sockjs"); -module.exports = class SockJSClient { +module.exports = class WebSocketClient { constructor(url) { - this.sock = new SockJS( - url.replace(/^ws:/i, "http://").replace(/^wss:/i, "https://"), - ); + this.client = new WebSocket(url); + this.client.onerror = (error) => { + console.error(error); + }; } onOpen(f) { - this.sock.onopen = () => { + this.client.onopen = () => { console.log("open"); f(); }; } onClose(f) { - this.sock.onclose = () => { + this.client.onclose = () => { console.log("close"); f(); }; @@ -25,7 +26,7 @@ module.exports = class SockJSClient { // call f with the message string as the first argument onMessage(f) { - this.sock.onmessage = (e) => { + this.client.onmessage = (e) => { const obj = JSON.parse(e.data); console.log(obj.type); f(e.data); diff --git a/test/fixtures/provide-plugin-custom/foo.js b/test/fixtures/provide-plugin-custom/foo.js index c28b40f73c..c1faff1c20 100644 --- a/test/fixtures/provide-plugin-custom/foo.js +++ b/test/fixtures/provide-plugin-custom/foo.js @@ -1,7 +1,7 @@ "use strict"; // 'npm run prepare' must be run for this to work during testing -const CustomClient = require("../../fixtures/custom-client/CustomSockJSClient"); +const CustomClient = require("../custom-client/CustomWebSocketClient"); window.expectedClient = CustomClient; // eslint-disable-next-line camelcase, no-undef diff --git a/test/fixtures/provide-plugin-sockjs-config/foo.js b/test/fixtures/provide-plugin-sockjs-config/foo.js deleted file mode 100644 index dd47486385..0000000000 --- a/test/fixtures/provide-plugin-sockjs-config/foo.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; - -// 'npm run prepare' must be run for this to work during testing -const SockJSClient = require("../../../client/clients/SockJSClient").default; - -window.expectedClient = SockJSClient; -// eslint-disable-next-line camelcase, no-undef -window.injectedClient = __webpack_dev_server_client__.default; diff --git a/test/fixtures/provide-plugin-sockjs-config/webpack.config.js b/test/fixtures/provide-plugin-sockjs-config/webpack.config.js deleted file mode 100644 index 6006074030..0000000000 --- a/test/fixtures/provide-plugin-sockjs-config/webpack.config.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -const HTMLGeneratorPlugin = require("../../helpers/html-generator-plugin"); - -module.exports = { - mode: "development", - context: __dirname, - stats: "none", - entry: "./foo.js", - output: { - path: "/", - }, - node: false, - infrastructureLogging: { - level: "info", - stream: { - write: () => {}, - }, - }, - plugins: [new HTMLGeneratorPlugin()], -}; diff --git a/test/normalize-options.test.js b/test/normalize-options.test.js index b3ae68c021..b80d418ed0 100644 --- a/test/normalize-options.test.js +++ b/test/normalize-options.test.js @@ -19,15 +19,6 @@ describe("normalize options", () => { port: "9000", }, }, - { - title: "client.webSocketTransport sockjs string", - multiCompiler: false, - options: { - client: { - webSocketTransport: "sockjs", - }, - }, - }, { title: "client.webSocketTransport ws string", multiCompiler: false, diff --git a/test/ports-map.js b/test/ports-map.js index d95dc62af9..d898970fdf 100644 --- a/test/ports-map.js +++ b/test/ports-map.js @@ -7,7 +7,6 @@ const listOfTests = { "cli-port-option": 1, // e2e tests bundle: 1, - "sockjs-client": 1, "web-socket-client": 1, "hot-and-live-reload": 1, logging: 1, @@ -43,7 +42,6 @@ const listOfTests = { "stats-option": 1, "watch-files-option": 1, "web-socket-server-option": 1, - "sockjs-server": 1, "web-socket-server": 1, routes: 1, "web-socket-communication": 1, diff --git a/test/server/proxy-option.test.js b/test/server/proxy-option.test.js index d6c209e055..dcc0fae9bf 100644 --- a/test/server/proxy-option.test.js +++ b/test/server/proxy-option.test.js @@ -596,7 +596,7 @@ describe("proxy option", () => { let webSocketServer; let responseMessage; - const webSocketServerTypes = ["sockjs", "ws"]; + const webSocketServerTypes = ["ws"]; for (const webSocketServerType of webSocketServerTypes) { // eslint-disable-next-line no-loop-func diff --git a/test/validate-options.test.js b/test/validate-options.test.js index b92f9be1fd..97590dfc13 100644 --- a/test/validate-options.test.js +++ b/test/validate-options.test.js @@ -68,10 +68,7 @@ const tests = { }, }, { - webSocketTransport: "sockjs", - }, - { - webSocketTransport: require.resolve("../client/clients/SockJSClient"), + webSocketTransport: "ws", }, { webSocketURL: "ws://localhost:8080", @@ -502,7 +499,6 @@ const tests = { success: [ false, "ws", - "sockjs", { type: "ws", options: { diff --git a/types/lib/Server.d.ts b/types/lib/Server.d.ts index 47dfba4c62..d86b065357 100644 --- a/types/lib/Server.d.ts +++ b/types/lib/Server.d.ts @@ -1654,29 +1654,22 @@ type WebSocketServerConfiguration = { /** * type */ - type?: - | ("sockjs" | "ws" | string | (() => WebSocketServerConfiguration)) - | undefined; + type?: ("ws" | string | (() => WebSocketServerConfiguration)) | undefined; /** * options */ options?: Record | undefined; }; -type ClientConnection = ( - | import("ws").WebSocket - | (import("sockjs").Connection & { - send: import("ws").WebSocket["send"]; - terminate: import("ws").WebSocket["terminate"]; - ping: import("ws").WebSocket["ping"]; - }) -) & { +type ClientConnection = (import("ws").WebSocket & { + send: import("ws").WebSocket["send"]; + terminate: import("ws").WebSocket["terminate"]; + ping: import("ws").WebSocket["ping"]; +}) & { isAlive?: boolean; }; -type WebSocketServer = - | import("ws").WebSocketServer - | (import("sockjs").Server & { - close: import("ws").WebSocketServer["close"]; - }); +type WebSocketServer = import("ws").WebSocketServer & { + close: import("ws").WebSocketServer["close"]; +}; type WebSocketServerImplementation = { implementation: WebSocketServer; clients: ClientConnection[]; @@ -1773,7 +1766,7 @@ type ClientConfiguration = { /** * web socket transport */ - webSocketTransport?: ("ws" | "sockjs" | string) | undefined; + webSocketTransport?: ("ws" | string) | undefined; /** * web socket URL */ @@ -1821,7 +1814,7 @@ type Configuration< server?: (ServerType | ServerConfiguration) | undefined; app?: (() => Promise
) | undefined; webSocketServer?: - | (boolean | "sockjs" | "ws" | string | WebSocketServerConfiguration) + | (boolean | "ws" | string | WebSocketServerConfiguration) | undefined; proxy?: ProxyConfigArray | undefined; open?: (boolean | string | Open | Array) | undefined; diff --git a/types/lib/servers/SockJSServer.d.ts b/types/lib/servers/SockJSServer.d.ts deleted file mode 100644 index 8116b4dd9d..0000000000 --- a/types/lib/servers/SockJSServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export = SockJSServer; -declare class SockJSServer extends BaseServer { - implementation: sockjs.Server; -} -declare namespace SockJSServer { - export { WebSocketServerConfiguration, ClientConnection }; -} -import BaseServer = require("./BaseServer"); -import sockjs = require("sockjs"); -type WebSocketServerConfiguration = - import("../Server").WebSocketServerConfiguration; -type ClientConnection = import("../Server").ClientConnection;