From 0002ebfbc8f36e92f91013372c9e2bca97022825 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Thu, 9 Sep 2021 20:58:26 +0530 Subject: [PATCH] fix: respect `https.cacert` option (#3820) --- README.md | 91 +- bin/cli-flags.js | 145 +++- examples/http2/README.md | 4 +- examples/https/README.md | 6 +- lib/Server.js | 53 +- lib/options.json | 124 ++- migration-v4.md | 4 +- .../validate-options.test.js.snap.webpack4 | 42 +- .../validate-options.test.js.snap.webpack5 | 42 +- .../__snapshots__/basic.test.js.snap.webpack4 | 16 +- .../__snapshots__/basic.test.js.snap.webpack5 | 16 +- .../__snapshots__/https.test.js.snap.webpack4 | 501 ++++++++++- .../__snapshots__/https.test.js.snap.webpack5 | 501 ++++++++++- test/e2e/https.test.js | 778 +++++++++++++++++- test/helpers/normalize-options.js | 38 + test/validate-options.test.js | 92 ++- 16 files changed, 2253 insertions(+), 200 deletions(-) create mode 100644 test/helpers/normalize-options.js diff --git a/README.md b/README.md index 598dcbcd3c..6b84460521 100644 --- a/README.md +++ b/README.md @@ -73,76 +73,78 @@ Options: --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --entry The entry point(s) of your application e.g. ./src/main.js. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + -t, --target Sets the build target e.g. node. -d, --devtool Determine source maps to use. --no-devtool Do not generate source maps. - --entry The entry point(s) of your application e.g. ./src/main.js. --mode Defines the mode to pass to webpack. --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. --stats [value] It instructs webpack on how to treat the stats e.g. verbose. --no-stats Disable stats output. - -t, --target Sets the build target e.g. node. - --no-target Negative 'target' option. --watch-options-stdin Stop watching when stdin stream has ended. --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --allowed-hosts Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying - dev server, by default is 'auto'). - --allowed-hosts-reset Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to - the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). + --allowed-hosts Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). + --allowed-hosts-reset Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). --bonjour Allows to broadcasts dev server via ZeroConf networking on start. - --no-bonjour Negative 'bonjour' option. + --no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start. + --client-web-socket-transport Allows to set custom web socket transport to communicate with dev server. --no-client Negative 'client' option. --client-logging Allows to specify options for client script in the browser or disable client script. + --client-progress Prints compilation progress in percentage in the browser. + --no-client-progress Does not print compilation progress in percentage in the browser. --client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Negative 'client-overlay' option. + --no-client-overlay Disables a full-screen overlay in the browser when there are compiler errors or warnings. --client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors. --no-client-overlay-errors Negative 'client-overlay-errors' option. --client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings. --no-client-overlay-warnings Negative 'client-overlay-warnings' option. - --client-progress Prints compilation progress in percentage in the browser. - --no-client-progress Negative 'client-progress' option. - --client-web-socket-transport Allows to set custom web socket transport to communicate with dev server. - --client-web-socket-url Allows to specify URL to web socket server (useful when you're proxying dev server and client script does - not always know where to connect to). + --client-web-socket-url Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to). --client-web-socket-url-hostname Tells clients connected to devServer to use the provided hostname. - --client-web-socket-url-pathname Tells clients connected to devServer to use the provided path to connect. - --client-web-socket-url-password Tells clients connected to devServer to use the provided password to authenticate. --client-web-socket-url-port Tells clients connected to devServer to use the provided port. + --client-web-socket-url-pathname Tells clients connected to devServer to use the provided path to connect. --client-web-socket-url-protocol Tells clients connected to devServer to use the provided protocol. --client-web-socket-url-username Tells clients connected to devServer to use the provided username to authenticate. + --client-web-socket-url-password Tells clients connected to devServer to use the provided password to authenticate. + --web-socket-server Allows to set web socket server and options (by default 'ws'). + --no-web-socket-server Negative 'web-socket-server' option. --compress Enables gzip compression for everything served. - --no-compress Negative 'compress' option. - --history-api-fallback Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page - Applications that utilise the HTML5 History API. + --no-compress Disables gzip compression for everything served. + --history-api-fallback Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API. --no-history-api-fallback Negative 'history-api-fallback' option. --host Allows to specify a hostname to use. --hot [value] Enables Hot Module Replacement. - --no-hot Negative 'hot' option. + --no-hot Disables Hot Module Replacement. --http2 Allows to serve over HTTP/2 using SPDY. - --no-http2 Negative 'http2' option. + --no-http2 Does not serve over HTTP/2 using SPDY. --https Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). - --no-https Negative 'https' option. + --no-https Disallows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). --https-passphrase Passphrase for a pfx file. --https-request-cert Request for an SSL certificate. - --no-https-request-cert Negative 'https-request-cert' option. - --https-cacert Path to an SSL CA certificate. - --https-key Path to an SSL key. - --https-pfx Path to an SSL pfx file. - --https-cert Path to an SSL certificate. + --no-https-request-cert Does not request for an SSL certificate. + --https-ca Path to an SSL CA certificate or content of an SSL CA certificate. + --https-ca-reset Clear all items provided in 'https.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. + --https-cacert Path to an SSL CA certificate or content of an SSL CA certificate. + --https-cacert-reset Clear all items provided in 'https.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. + --https-key Path to an SSL key or content of an SSL key. + --https-key-reset Clear all items provided in 'https.key' configuration. Path to an SSL key or content of an SSL key. + --https-pfx Path to an SSL pfx file or content of an SSL pfx file. + --https-pfx-reset Clear all items provided in 'https.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. + --https-cert Path to an SSL certificate or content of an SSL certificate. + --https-cert-reset Clear all items provided in 'https.cert' configuration. Path to an SSL certificate or content of an SSL certificate. + --https-crl Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). + --https-crl-reset Clear all items provided in 'https.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). --ipc [value] Listen to a unix socket. --live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default). - --no-live-reload Negative 'live-reload' option. - --magic-html Tells dev-server whether to enable magic HTML routes (routes corresponding to your webpack output, for - example '/main' for 'main.js'). - --no-magic-html Negative 'magic-html' option. - --open [value...] Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to - true to open your default browser). - --no-open Negative 'open' option. + --no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default) + --magic-html Tells dev-server whether to enable magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js'). + --no-magic-html Disables magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js'). + --open [value...] Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). + --no-open Does not open the default browser. --open-target Opens specified page in browser. --open-app-name Open specified browser. --open-app Open specified browser. - --open-reset Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and - page(s) after server had been started (set it to true to open your default browser). + --open-reset Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). --open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser. --open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser. --port Allows to specify a port to use. @@ -151,18 +153,13 @@ Options: --static-directory Directory for static contents. --static-public-path The static files will be available in the browser under this public path. --static-serve-index Tells dev server to use serveIndex middleware when enabled. - --no-static-serve-index Negative 'static-serve-index' option. + --no-static-serve-index Does not tell dev server to use serveIndex middleware. --static-watch Watches for files in static content directory. - --no-static-watch Negative 'static-watch' option. - --static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files - from directory (by default 'public' directory). - --static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the - browser under this public path. + --no-static-watch Does not watch for files in static content directory. + --static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public' directory). + --static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path. --watch-files Allows to configure list of globs/directories/files to watch for file changes. - --watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files - to watch for file changes. - --web-socket-server Allows to set web socket server and options (by default 'ws'). - --no-web-socket-server Negative 'web-socket-server' option. + --watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes. Global options: --color Enable colors on console. diff --git a/bin/cli-flags.js b/bin/cli-flags.js index ed9aece694..55e36d7bc4 100644 --- a/bin/cli-flags.js +++ b/bin/cli-flags.js @@ -445,57 +445,180 @@ module.exports = { simpleType: "boolean", multiple: false, }, + "https-ca": { + configs: [ + { + type: "string", + multiple: true, + description: + "Path to an SSL CA certificate or content of an SSL CA certificate.", + path: "https.ca[]", + }, + ], + description: + "Path to an SSL CA certificate or content of an SSL CA certificate.", + simpleType: "string", + multiple: true, + }, + "https-ca-reset": { + configs: [ + { + description: + "Clear all items provided in 'https.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.", + multiple: false, + path: "https.ca", + type: "reset", + }, + ], + description: + "Clear all items provided in 'https.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.", + multiple: false, + simpleType: "boolean", + }, "https-cacert": { configs: [ { type: "string", + multiple: true, + description: + "Path to an SSL CA certificate or content of an SSL CA certificate.", + path: "https.cacert[]", + }, + ], + description: + "Path to an SSL CA certificate or content of an SSL CA certificate.", + simpleType: "string", + multiple: true, + }, + "https-cacert-reset": { + configs: [ + { + description: + "Clear all items provided in 'https.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.", multiple: false, - description: "Path to an SSL CA certificate.", path: "https.cacert", + type: "reset", }, ], - description: "Path to an SSL CA certificate.", - simpleType: "string", + description: + "Clear all items provided in 'https.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.", multiple: false, + simpleType: "boolean", }, "https-key": { configs: [ { type: "string", + multiple: true, + description: "Path to an SSL key or content of an SSL key.", + path: "https.key[]", + }, + ], + description: "Path to an SSL key or content of an SSL key.", + simpleType: "string", + multiple: true, + }, + "https-key-reset": { + configs: [ + { + description: + "Clear all items provided in 'https.key' configuration. Path to an SSL key or content of an SSL key.", multiple: false, - description: "Path to an SSL key.", path: "https.key", + type: "reset", }, ], - description: "Path to an SSL key.", - simpleType: "string", + description: + "Clear all items provided in 'https.key' configuration. Path to an SSL key or content of an SSL key.", multiple: false, + simpleType: "boolean", }, "https-pfx": { configs: [ { type: "string", + multiple: true, + description: "Path to an SSL pfx file or content of an SSL pfx file.", + path: "https.pfx[]", + }, + ], + description: "Path to an SSL pfx file or content of an SSL pfx file.", + simpleType: "string", + multiple: true, + }, + "https-pfx-reset": { + configs: [ + { + description: + "Clear all items provided in 'https.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file.", multiple: false, - description: "Path to an SSL pfx file.", path: "https.pfx", + type: "reset", }, ], - description: "Path to an SSL pfx file.", - simpleType: "string", + description: + "Clear all items provided in 'https.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file.", multiple: false, + simpleType: "boolean", }, "https-cert": { configs: [ { type: "string", + multiple: true, + description: + "Path to an SSL certificate or content of an SSL certificate.", + path: "https.cert[]", + }, + ], + description: "Path to an SSL certificate or content of an SSL certificate.", + simpleType: "string", + multiple: true, + }, + "https-cert-reset": { + configs: [ + { + description: + "Clear all items provided in 'https.cert' configuration. Path to an SSL certificate or content of an SSL certificate.", multiple: false, - description: "Path to an SSL certificate.", path: "https.cert", + type: "reset", + }, + ], + description: + "Clear all items provided in 'https.cert' configuration. Path to an SSL certificate or content of an SSL certificate.", + multiple: false, + simpleType: "boolean", + }, + "https-crl": { + configs: [ + { + description: + "Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).", + multiple: true, + path: "https.crl[]", + type: "string", }, ], - description: "Path to an SSL certificate.", + description: + "Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).", + multiple: true, simpleType: "string", + }, + "https-crl-reset": { + configs: [ + { + description: + "Clear all items provided in 'https.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).", + multiple: false, + path: "https.crl", + type: "reset", + }, + ], + description: + "Clear all items provided in 'https.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).", multiple: false, + simpleType: "boolean", }, ipc: { configs: [ diff --git a/examples/http2/README.md b/examples/http2/README.md index 9577973ad2..87c080f003 100644 --- a/examples/http2/README.md +++ b/examples/http2/README.md @@ -36,7 +36,7 @@ module.exports = { key: "./ssl/server.key", pfx: "./ssl/server.pfx", cert: "./ssl/server.crt", - cacert: "./ssl/ca.pem", + ca: "./ssl/ca.pem", passphrase: "webpack-dev-server", }, }, @@ -46,7 +46,7 @@ module.exports = { Usage via CLI: ```console -npx webpack serve --open --http2 --https-key ./ssl/server.key --https-pfx ./ssl/server.pfx --https-cert ./ssl/server.crt --https-cacert ./ssl/ca.pem --https-passphrase webpack-dev-server +npx webpack serve --open --http2 --https-key ./ssl/server.key --https-pfx ./ssl/server.pfx --https-cert ./ssl/server.crt --https-ca ./ssl/ca.pem --https-passphrase webpack-dev-server ``` ## What Should Happen diff --git a/examples/https/README.md b/examples/https/README.md index 2a04e83158..2d766d829e 100644 --- a/examples/https/README.md +++ b/examples/https/README.md @@ -28,7 +28,7 @@ Customize `https` configuration with the following options: - `key`: Path to an SSL key. - `pfx`: Path to an SSL pfx file. - `cert`: Path to an SSL certificate. -- `cacert`: Path to an SSL CA certificate. +- `ca`: Path to an SSL CA certificate. - `passphrase`: Passphrase for a pfx file. - `requestCert`: Request for an SSL certificate. @@ -40,7 +40,7 @@ module.exports = { key: "./ssl/server.key", pfx: "./ssl/server.pfx", cert: "./ssl/server.crt", - cacert: "./ssl/ca.pem", + ca: "./ssl/ca.pem", passphrase: "webpack-dev-server", requestCert: true, }, @@ -51,7 +51,7 @@ module.exports = { Usage via CLI: ```console -npx webpack serve --open --https-key ./ssl/server.key --https-pfx ./ssl/server.pfx --https-cert ./ssl/server.crt --https-cacert ./ssl/ca.pem --https-passphrase webpack-dev-server --https-request-cert +npx webpack serve --open --https-key ./ssl/server.key --https-pfx ./ssl/server.pfx --https-cert ./ssl/server.crt --https-ca ./ssl/ca.pem --https-passphrase webpack-dev-server --https-request-cert ``` ## What Should Happen diff --git a/lib/Server.js b/lib/Server.js index 0f620d0df5..26c72599cb 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -517,24 +517,39 @@ class Server { // https option if (options.https) { - for (const property of ["cacert", "pfx", "key", "cert"]) { + // TODO remove the `cacert` option in favor `ca` in the next major release + for (const property of ["cacert", "ca", "cert", "crl", "key", "pfx"]) { + if (typeof options.https[property] === "undefined") { + // eslint-disable-next-line no-continue + continue; + } + const value = options.https[property]; - const isBuffer = value instanceof Buffer; + const readFile = (item) => { + if ( + Buffer.isBuffer(item) || + (typeof item === "object" && item !== null && !Array.isArray(item)) + ) { + return item; + } - if (value && !isBuffer) { - let stats = null; + if (item) { + let stats = null; - try { - stats = fs.lstatSync(fs.realpathSync(value)).isFile(); - } catch (error) { - // ignore error + try { + stats = fs.lstatSync(fs.realpathSync(item)).isFile(); + } catch (error) { + // Ignore error + } + + // It is file + return stats ? fs.readFileSync(item) : item; } + }; - // It is file - options.https[property] = stats - ? fs.readFileSync(path.resolve(value)) - : value; - } + options.https[property] = Array.isArray(value) + ? value.map((item) => readFile(item)) + : readFile(value); } let fakeCert; @@ -654,6 +669,18 @@ class Server { this.logger.info(`SSL certificate: ${certificatePath}`); } + if (options.https.cacert) { + if (options.https.ca) { + this.logger.warn( + "Do not specify 'https.ca' and 'https.cacert' options together, the 'https.ca' option will be used." + ); + } else { + options.https.ca = options.https.cacert; + } + + delete options.https.cacert; + } + options.https.key = options.https.key || fakeCert; options.https.cert = options.https.cert || fakeCert; } diff --git a/lib/options.json b/lib/options.json index dba43c89f1..e647804f7d 100644 --- a/lib/options.json +++ b/lib/options.json @@ -201,7 +201,7 @@ }, { "type": "object", - "additionalProperties": false, + "additionalProperties": true, "properties": { "passphrase": { "type": "string", @@ -211,8 +211,45 @@ "type": "boolean", "description": "Request for an SSL certificate." }, + "ca": { + "anyOf": [ + { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "instanceof": "Buffer" + } + ] + } + }, + { + "type": "string" + }, + { + "instanceof": "Buffer" + } + ], + "description": "Path to an SSL CA certificate or content of an SSL CA certificate." + }, "cacert": { "anyOf": [ + { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "instanceof": "Buffer" + } + ] + } + }, { "type": "string" }, @@ -220,10 +257,23 @@ "instanceof": "Buffer" } ], - "description": "Path to an SSL CA certificate." + "description": "Path to an SSL CA certificate or content of an SSL CA certificate." }, - "key": { + "cert": { "anyOf": [ + { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "instanceof": "Buffer" + } + ] + } + }, { "type": "string" }, @@ -231,10 +281,23 @@ "instanceof": "Buffer" } ], - "description": "Path to an SSL key." + "description": "Path to an SSL certificate or content of an SSL certificate." }, - "pfx": { + "crl": { "anyOf": [ + { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "instanceof": "Buffer" + } + ] + } + }, { "type": "string" }, @@ -242,10 +305,55 @@ "instanceof": "Buffer" } ], - "description": "Path to an SSL pfx file." + "description": "Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists)." }, - "cert": { + "key": { + "anyOf": [ + { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "instanceof": "Buffer" + }, + { + "type": "object", + "additionalProperties": true + } + ] + } + }, + { + "type": "string" + }, + { + "instanceof": "Buffer" + } + ], + "description": "Path to an SSL key or content of an SSL key." + }, + "pfx": { "anyOf": [ + { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "instanceof": "Buffer" + }, + { + "type": "object", + "additionalProperties": true + } + ] + } + }, { "type": "string" }, @@ -253,7 +361,7 @@ "instanceof": "Buffer" } ], - "description": "Path to an SSL certificate." + "description": "Path to an SSL pfx file or content of an SSL pfx file." } } } diff --git a/migration-v4.md b/migration-v4.md index a0f920bf51..84543d9e79 100644 --- a/migration-v4.md +++ b/migration-v4.md @@ -98,7 +98,7 @@ module.exports = { ``` - The `features` option was removed in favor `onBeforeSetupMiddleware` and `onAfterSetupMiddleware` options. -- The `key`, `cert`, `pfx`, `pfx-passphrase`, `cacert`, and `requestCert` options were moved to `https` options, please use `https.{key|cert|pfx|passphrase|requestCert|cacert}`. +- The `key`, `cert`, `pfx`, `pfx-passphrase`, `cacert`, `ca` and `requestCert` options were moved to `https` options, please use `https.{key|cert|pfx|passphrase|requestCert|ca}`. v3: @@ -121,7 +121,7 @@ v4: module.exports = { devServer: { https: { - cacert: "./server.pem", + ca: "./server.pem", pfx: "./server.pfx", key: "./server.key", cert: "./server.crt", diff --git a/test/__snapshots__/validate-options.test.js.snap.webpack4 b/test/__snapshots__/validate-options.test.js.snap.webpack4 index c74393cbf8..becb276ac9 100644 --- a/test/__snapshots__/validate-options.test.js.snap.webpack4 +++ b/test/__snapshots__/validate-options.test.js.snap.webpack4 @@ -322,26 +322,28 @@ exports[`options validate should throw an error on the "http2" option with '' va exports[`options validate should throw an error on the "https" option with '' value 1`] = ` "ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options.https should be one of these: - boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? } + boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … } -> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). -> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps Details: * options.https should be a boolean. * options.https should be an object: - object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }" + object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … }" `; exports[`options validate should throw an error on the "https" option with '{"cacert":true}' value 1`] = ` "ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options.https should be one of these: - boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? } + boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … } -> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). -> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps Details: * options.https.cacert should be one of these: - string | Buffer - -> Path to an SSL CA certificate. + [string | Buffer, ...] | string | Buffer + -> Path to an SSL CA certificate or content of an SSL CA certificate. Details: + * options.https.cacert should be an array: + [string | Buffer, ...] * options.https.cacert should be a string. * options.https.cacert should be an instance of Buffer." `; @@ -349,35 +351,33 @@ exports[`options validate should throw an error on the "https" option with '{"ca exports[`options validate should throw an error on the "https" option with '{"cert":true}' value 1`] = ` "ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options.https should be one of these: - boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? } + boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … } -> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). -> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps Details: * options.https.cert should be one of these: - string | Buffer - -> Path to an SSL certificate. + [string | Buffer, ...] | string | Buffer + -> Path to an SSL certificate or content of an SSL certificate. Details: + * options.https.cert should be an array: + [string | Buffer, ...] * options.https.cert should be a string. * options.https.cert should be an instance of Buffer." `; -exports[`options validate should throw an error on the "https" option with '{"foo":"bar"}' value 1`] = ` -"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - - options.https has an unknown property 'foo'. These properties are valid: - object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }" -`; - exports[`options validate should throw an error on the "https" option with '{"key":10}' value 1`] = ` "ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options.https should be one of these: - boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? } + boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … } -> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). -> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps Details: * options.https.key should be one of these: - string | Buffer - -> Path to an SSL key. + [string | Buffer | object { … }, ...] | string | Buffer + -> Path to an SSL key or content of an SSL key. Details: + * options.https.key should be an array: + [string | Buffer | object { … }, ...] * options.https.key should be a string. * options.https.key should be an instance of Buffer." `; @@ -391,14 +391,16 @@ exports[`options validate should throw an error on the "https" option with '{"pa exports[`options validate should throw an error on the "https" option with '{"pfx":10}' value 1`] = ` "ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options.https should be one of these: - boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? } + boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … } -> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). -> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps Details: * options.https.pfx should be one of these: - string | Buffer - -> Path to an SSL pfx file. + [string | Buffer | object { … }, ...] | string | Buffer + -> Path to an SSL pfx file or content of an SSL pfx file. Details: + * options.https.pfx should be an array: + [string | Buffer | object { … }, ...] * options.https.pfx should be a string. * options.https.pfx should be an instance of Buffer." `; diff --git a/test/__snapshots__/validate-options.test.js.snap.webpack5 b/test/__snapshots__/validate-options.test.js.snap.webpack5 index c74393cbf8..becb276ac9 100644 --- a/test/__snapshots__/validate-options.test.js.snap.webpack5 +++ b/test/__snapshots__/validate-options.test.js.snap.webpack5 @@ -322,26 +322,28 @@ exports[`options validate should throw an error on the "http2" option with '' va exports[`options validate should throw an error on the "https" option with '' value 1`] = ` "ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options.https should be one of these: - boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? } + boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … } -> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). -> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps Details: * options.https should be a boolean. * options.https should be an object: - object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }" + object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … }" `; exports[`options validate should throw an error on the "https" option with '{"cacert":true}' value 1`] = ` "ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options.https should be one of these: - boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? } + boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … } -> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). -> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps Details: * options.https.cacert should be one of these: - string | Buffer - -> Path to an SSL CA certificate. + [string | Buffer, ...] | string | Buffer + -> Path to an SSL CA certificate or content of an SSL CA certificate. Details: + * options.https.cacert should be an array: + [string | Buffer, ...] * options.https.cacert should be a string. * options.https.cacert should be an instance of Buffer." `; @@ -349,35 +351,33 @@ exports[`options validate should throw an error on the "https" option with '{"ca exports[`options validate should throw an error on the "https" option with '{"cert":true}' value 1`] = ` "ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options.https should be one of these: - boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? } + boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … } -> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). -> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps Details: * options.https.cert should be one of these: - string | Buffer - -> Path to an SSL certificate. + [string | Buffer, ...] | string | Buffer + -> Path to an SSL certificate or content of an SSL certificate. Details: + * options.https.cert should be an array: + [string | Buffer, ...] * options.https.cert should be a string. * options.https.cert should be an instance of Buffer." `; -exports[`options validate should throw an error on the "https" option with '{"foo":"bar"}' value 1`] = ` -"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - - options.https has an unknown property 'foo'. These properties are valid: - object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }" -`; - exports[`options validate should throw an error on the "https" option with '{"key":10}' value 1`] = ` "ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options.https should be one of these: - boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? } + boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … } -> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). -> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps Details: * options.https.key should be one of these: - string | Buffer - -> Path to an SSL key. + [string | Buffer | object { … }, ...] | string | Buffer + -> Path to an SSL key or content of an SSL key. Details: + * options.https.key should be an array: + [string | Buffer | object { … }, ...] * options.https.key should be a string. * options.https.key should be an instance of Buffer." `; @@ -391,14 +391,16 @@ exports[`options validate should throw an error on the "https" option with '{"pa exports[`options validate should throw an error on the "https" option with '{"pfx":10}' value 1`] = ` "ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options.https should be one of these: - boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? } + boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … } -> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). -> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps Details: * options.https.pfx should be one of these: - string | Buffer - -> Path to an SSL pfx file. + [string | Buffer | object { … }, ...] | string | Buffer + -> Path to an SSL pfx file or content of an SSL pfx file. Details: + * options.https.pfx should be an array: + [string | Buffer | object { … }, ...] * options.https.pfx should be a string. * options.https.pfx should be an instance of Buffer." `; diff --git a/test/cli/__snapshots__/basic.test.js.snap.webpack4 b/test/cli/__snapshots__/basic.test.js.snap.webpack4 index 27f826749d..0e593d2855 100644 --- a/test/cli/__snapshots__/basic.test.js.snap.webpack4 +++ b/test/cli/__snapshots__/basic.test.js.snap.webpack4 @@ -92,10 +92,18 @@ Options: --https-passphrase Passphrase for a pfx file. --https-request-cert Request for an SSL certificate. --no-https-request-cert Does not request for an SSL certificate. - --https-cacert Path to an SSL CA certificate. - --https-key Path to an SSL key. - --https-pfx Path to an SSL pfx file. - --https-cert Path to an SSL certificate. + --https-ca Path to an SSL CA certificate or content of an SSL CA certificate. + --https-ca-reset Clear all items provided in 'https.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. + --https-cacert Path to an SSL CA certificate or content of an SSL CA certificate. + --https-cacert-reset Clear all items provided in 'https.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. + --https-key Path to an SSL key or content of an SSL key. + --https-key-reset Clear all items provided in 'https.key' configuration. Path to an SSL key or content of an SSL key. + --https-pfx Path to an SSL pfx file or content of an SSL pfx file. + --https-pfx-reset Clear all items provided in 'https.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. + --https-cert Path to an SSL certificate or content of an SSL certificate. + --https-cert-reset Clear all items provided in 'https.cert' configuration. Path to an SSL certificate or content of an SSL certificate. + --https-crl Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). + --https-crl-reset Clear all items provided in 'https.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). --ipc [value] Listen to a unix socket. --live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default). --no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default) diff --git a/test/cli/__snapshots__/basic.test.js.snap.webpack5 b/test/cli/__snapshots__/basic.test.js.snap.webpack5 index a9abd9cc46..e9ea671b59 100644 --- a/test/cli/__snapshots__/basic.test.js.snap.webpack5 +++ b/test/cli/__snapshots__/basic.test.js.snap.webpack5 @@ -91,10 +91,18 @@ Options: --https-passphrase Passphrase for a pfx file. --https-request-cert Request for an SSL certificate. --no-https-request-cert Negative 'https-request-cert' option. - --https-cacert Path to an SSL CA certificate. - --https-key Path to an SSL key. - --https-pfx Path to an SSL pfx file. - --https-cert Path to an SSL certificate. + --https-ca Path to an SSL CA certificate or content of an SSL CA certificate. + --https-ca-reset Clear all items provided in 'https.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. + --https-cacert Path to an SSL CA certificate or content of an SSL CA certificate. + --https-cacert-reset Clear all items provided in 'https.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. + --https-cert Path to an SSL certificate or content of an SSL certificate. + --https-cert-reset Clear all items provided in 'https.cert' configuration. Path to an SSL certificate or content of an SSL certificate. + --https-crl Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). + --https-crl-reset Clear all items provided in 'https.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). + --https-key Path to an SSL key or content of an SSL key. + --https-key-reset Clear all items provided in 'https.key' configuration. Path to an SSL key or content of an SSL key. + --https-pfx Path to an SSL pfx file or content of an SSL pfx file. + --https-pfx-reset Clear all items provided in 'https.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. --ipc [value] Listen to a unix socket. --live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default). --no-live-reload Negative 'live-reload' option. diff --git a/test/e2e/__snapshots__/https.test.js.snap.webpack4 b/test/e2e/__snapshots__/https.test.js.snap.webpack4 index 7599a45a04..897728d71f 100644 --- a/test/e2e/__snapshots__/https.test.js.snap.webpack4 +++ b/test/e2e/__snapshots__/https.test.js.snap.webpack4 @@ -1,34 +1,501 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): console messages 1`] = `Array []`; +exports[`https option as an object and allow to pass more options should handle GET request to index route (/): console messages 1`] = `Array []`; -exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): page errors 1`] = `Array []`; +exports[`https option as an object and allow to pass more options should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "", + "cert": "", + "key": "", + "minVersion": "TLSv1.1", + "passphrase": "webpack-dev-server", + "pfx": "", +} +`; -exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): response status 1`] = `200`; +exports[`https option as an object and allow to pass more options should handle GET request to index route (/): page errors 1`] = `Array []`; -exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): response text 1`] = ` +exports[`https option as an object and allow to pass more options should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object and allow to pass more options should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are array of buffers should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are array of buffers should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": Array [ + "", + ], + "cert": Array [ + "", + ], + "key": Array [ + "", + ], + "passphrase": "webpack-dev-server", + "pfx": Array [ + "", + ], +} +`; + +exports[`https option as an object when ca, pfx, key and cert are array of buffers should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are array of buffers should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are array of buffers should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are array of paths to files should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are array of paths to files should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": Array [ + "", + ], + "cert": Array [ + "", + ], + "key": Array [ + "", + ], + "passphrase": "webpack-dev-server", + "pfx": Array [ + "", + ], +} +`; + +exports[`https option as an object when ca, pfx, key and cert are array of paths to files should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are array of paths to files should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are array of paths to files should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are array of strings should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are array of strings should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": Array [ + "-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEAxAUVLFM+K3XDLQkBi7xt0s1Ip7JoHYDskzUDQNHjjMkUq5kv +C/hf5Ei1J6qruJs3Xqg86Nl4+ed4ynUajAkRRibhp0P1SG1tgPssIK6iC7g8heYu +Dy9WkFuMie0513zjSn6bMEAK5TegxYAWCbaCZX/Fw9bDniabL/zuOv4sf8J4EPhs +EENnH6sUE9HxPUgQmNt1Tbd0j1Cd5PXrSTLyfVPRh0m9QhXTUHuxsse8XSn9U2sw +duxJTWRINmhffYn+O7kbJGI77xYr8u58Rsf3HCMI8DTKZNvQLChvvtLJ9ckyu7Q+ +T8emgklStASm3V2UtnriaK/IQEhgSdxqVRib3QIDAQABAoIBAGqWKPE1QnT3T+3J +G+ITz9P0dDFbvWltlTZmeSJh/s2q+WZloUNtBxdmwbqT/1QecnkyGgyzVCjvSKsu +CgVjWNVAhysgtNtxRT4BVflffBXLVH2qsBjpsLRGU6EcMXuPGTiEp3YRHNuO6Aj8 +oP8fEsCGPc9DlJMGgxQRAKlrVF8TN/0j6Qk+YpS4MZ0YFQfBY+WdKu04Z8TVTplQ +tTkiGpBI+Oj85jF59aQiizglJgADkAZ6zmbrctm/G9jPxh7JLS2cKI0ECZgK5yAc +pk10E1YWhoCksjr9arxy6fS9TiX9P15vv06k+s7c4c5X7XDm3X0GWeSbqBMJb8q7 +BhZQNzECgYEA4kAtymDBvFYiZFq7+lzQBRKAI1RCq7YqxlieumH0PSkie2bba3dW +NVdTi7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zuvw18btgTtLVpVyeuqz +TU3eeF30cwKBgQCN6lvOmapsDEs+T3uhqx4AUH53qp63PmjOSUAnANJGmsq6ROZV +HmHAy6nn9Qpf85BRHCXhZWiMoIhvc3As/EINNtWxS6hC/q6jqp4SvcD50cVFBroY +/16iWGXZCX+37A+DSOfTWgSDPEFcKRx41UOpStHbITgVgEPieo/NWxlHmQKBgQDX +JOLs2RB6V0ilnpnjdPXzvncD9fHgmwvJap24BPeZX3HtXViqD76oZsu1mNCg9EW3 +zk3pnEyyoDlvSIreZerVq4kN3HWsCVP3Pqr0kz9g0CRtmy8RWr28hjHDfXD3xPUZ +iGnMEz7IOHOKv722/liFAprV1cNaLUmFbDNg3jmlaQKBgQDG5WwngPhOHmjTnSml +amfEz9a4yEhQqpqgVNW5wwoXOf6DbjL2m/maJh01giThj7inMcbpkZlIclxD0Eu6 +Lof+ctCeqSAJvaVPmd+nv8Yp26zsF1yM8ax9xXjrIvv9fSbycNveGTDCsNNTiYoW +QyvMqmN1kGy20SZbQDD/fLfqBQ== +-----END PRIVATE KEY----- +", + ], + "passphrase": "webpack-dev-server", + "pfx": Array [ + "", + ], +} +`; + +exports[`https option as an object when ca, pfx, key and cert are array of strings should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are array of strings should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are array of strings should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are buffer should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are buffer should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "", + "cert": "", + "key": "", + "passphrase": "webpack-dev-server", + "pfx": "", +} +`; + +exports[`https option as an object when ca, pfx, key and cert are buffer should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are buffer should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are buffer should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are buffer, key and pfx are objects should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are buffer, key and pfx are objects should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "", + "cert": "", + "key": Array [ + Object { + "pem": "", + }, + ], + "passphrase": "webpack-dev-server", + "pfx": Array [ + Object { + "buf": "", + }, + ], +} +`; + +exports[`https option as an object when ca, pfx, key and cert are buffer, key and pfx are objects should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are buffer, key and pfx are objects should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are buffer, key and pfx are objects should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are paths to files should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are paths to files should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "", + "cert": "", + "key": "", + "passphrase": "webpack-dev-server", + "pfx": "", +} +`; + +exports[`https option as an object when ca, pfx, key and cert are paths to files should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are paths to files should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are paths to files should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are strings should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are strings should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEAxAUVLFM+K3XDLQkBi7xt0s1Ip7JoHYDskzUDQNHjjMkUq5kv +C/hf5Ei1J6qruJs3Xqg86Nl4+ed4ynUajAkRRibhp0P1SG1tgPssIK6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oXOf6DbjL2m/maJh01giThj7inMcbpkZlIclxD0Eu6 +Lof+ctCeqSAJvaVPmd+nv8Yp26zsF1yM8ax9xXjrIvv9fSbycNveGTDCsNNTiYoW +QyvMqmN1kGy20SZbQDD/fLfqBQ== +-----END PRIVATE KEY----- +", + "passphrase": "webpack-dev-server", + "pfx": "", +} +`; + +exports[`https option as an object when ca, pfx, key and cert are strings should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are strings should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are strings should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are strings, key and pfx are objects should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are strings, key and pfx are objects should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEAxAUVLFM+K3XDLQkBi7xt0s1Ip7JoHYDskzUDQNHjjMkUq5kv +C/hf5Ei1J6qruJs3Xqg86Nl4+ed4ynUajAkRRibhp0P1SG1tgPssIK6iC7g8heYu +Dy9WkFuMie0513zjSn6bMEAK5TegxYAWCbaCZX/Fw9bDniabL/zuOv4sf8J4EPhs +EENnH6sUE9HxPUgQmNt1Tbd0j1Cd5PXrSTLyfVPRh0m9QhXTUHuxsse8XSn9U2sw +duxJTWRINmhffYn+O7kbJGI77xYr8u58Rsf3HCMI8DTKZNvQLChvvtLJ9ckyu7Q+ +T8emgklStASm3V2UtnriaK/IQEhgSdxqVRib3QIDAQABAoIBAGqWKPE1QnT3T+3J +G+ITz9P0dDFbvWltlTZmeSJh/s2q+WZloUNtBxdmwbqT/1QecnkyGgyzVCjvSKsu +CgVjWNVAhysgtNtxRT4BVflffBXLVH2qsBjpsLRGU6EcMXuPGTiEp3YRHNuO6Aj8 +oP8fEsCGPc9DlJMGgxQRAKlrVF8TN/0j6Qk+Yp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an8iVbxjIZKF1hnvNCxUoxYmWOmTLcEQMzmxvTzAiR+s6R6Uj +9LgGqppt30nM4wnOhOJU6UxqbwKBgQDdy03KidbPZuycJSy1C9AIt0jlrxDsYm+U +fZrB6mHEZcgoZS5GbLKinQCdGcgERa05BXvJmNbfZtT5a37YEnbjsTImIhDiBP5P +nW36/9a3Vg1svd1KP2206/Bh3gfZbgTsQg4YogXgjf0Uzuvw18btgTtLVpVyeuqz +TU3eeF30cwKBgQCN6lvOmapsDEs+T3uhqx4AUH53qp63PmjOSUAnANJGmsq6ROZV +HmHAy6nn9Qpf85BRHCXhZWiMoIhvc3As/EINNtWxS6hC/q6jqp4SvcD50cVFBroY +/16iWGXZCX+37A+DSOfTWgSDPEFcKRx41UOpStHbITgVgEPieo/NWxlHmQKBgQDX +JOLs2RB6V0ilnpnjdPXzvncD9fHgmwvJap24BPeZX3HtXViqD76oZsu1mNCg9EW3 +zk3pnEyyoDlvSIreZerVq4kN3HWsCVP3Pqr0kz9g0CRtmy8RWr28hjHDfXD3xPUZ +iGnMEz7IOHOKv722/liFAprV1cNaLUmFbDNg3jmlaQKBgQDG5WwngPhOHmjTnSml +amfEz9a4yEhQqpqgVNW5wwoXOf6DbjL2m/maJh01giThj7inMcbpkZlIclxD0Eu6 +Lof+ctCeqSAJvaVPmd+nv8Yp26zsF1yM8ax9xXjrIvv9fSbycNveGTDCsNNTiYoW +QyvMqmN1kGy20SZbQDD/fLfqBQ== +-----END PRIVATE KEY----- +", + }, + ], + "passphrase": "webpack-dev-server", + "pfx": Array [ + Object { + "buf": "", + }, + ], +} +`; + +exports[`https option as an object when ca, pfx, key and cert are strings, key and pfx are objects should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are strings, key and pfx are objects should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are strings, key and pfx are objects should handle GET request to index route (/): response text 1`] = ` "Heyo. " `; -exports[`https option as an object when cacert, pfx, key and cert are paths should handle GET request to index route (/): console messages 1`] = `Array []`; +exports[`https option as an object when cacert and ca, pfx, key and cert are buffer should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when cacert and ca, pfx, key and cert are buffer should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "", + "cert": "", + "key": "", + "passphrase": "webpack-dev-server", + "pfx": "", +} +`; -exports[`https option as an object when cacert, pfx, key and cert are paths should handle GET request to index route (/): page errors 1`] = `Array []`; +exports[`https option as an object when cacert and ca, pfx, key and cert are buffer should handle GET request to index route (/): page errors 1`] = `Array []`; -exports[`https option as an object when cacert, pfx, key and cert are paths should handle GET request to index route (/): response status 1`] = `200`; +exports[`https option as an object when cacert and ca, pfx, key and cert are buffer should handle GET request to index route (/): response status 1`] = `200`; -exports[`https option as an object when cacert, pfx, key and cert are paths should handle GET request to index route (/): response text 1`] = ` +exports[`https option as an object when cacert and ca, pfx, key and cert are buffer should handle GET request to index route (/): response text 1`] = ` "Heyo. " `; -exports[`https option as an object when cacert, pfx, key and cert are raw strings should handle GET request to index route (/): console messages 1`] = `Array []`; +exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): console messages 1`] = `Array []`; -exports[`https option as an object when cacert, pfx, key and cert are raw strings should handle GET request to index route (/): page errors 1`] = `Array []`; +exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "", + "cert": "", + "key": "", + "passphrase": "webpack-dev-server", + "pfx": "", +} +`; -exports[`https option as an object when cacert, pfx, key and cert are raw strings should handle GET request to index route (/): response status 1`] = `200`; +exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): page errors 1`] = `Array []`; -exports[`https option as an object when cacert, pfx, key and cert are raw strings should handle GET request to index route (/): response text 1`] = ` +exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): response text 1`] = ` "Heyo. " `; @@ -50,3 +517,13 @@ exports[`https option should support the "requestCert" option should handle GET "Heyo. " `; + +exports[`https option should support the "requestCert" option should pass options to the 'https.createServer' method: https options 1`] = ` +Object { + "cert": "", + "key": "", + "passphrase": "webpack-dev-server", + "pfx": "", + "requestCert": true, +} +`; diff --git a/test/e2e/__snapshots__/https.test.js.snap.webpack5 b/test/e2e/__snapshots__/https.test.js.snap.webpack5 index 7599a45a04..897728d71f 100644 --- a/test/e2e/__snapshots__/https.test.js.snap.webpack5 +++ b/test/e2e/__snapshots__/https.test.js.snap.webpack5 @@ -1,34 +1,501 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): console messages 1`] = `Array []`; +exports[`https option as an object and allow to pass more options should handle GET request to index route (/): console messages 1`] = `Array []`; -exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): page errors 1`] = `Array []`; +exports[`https option as an object and allow to pass more options should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "", + "cert": "", + "key": "", + "minVersion": "TLSv1.1", + "passphrase": "webpack-dev-server", + "pfx": "", +} +`; -exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): response status 1`] = `200`; +exports[`https option as an object and allow to pass more options should handle GET request to index route (/): page errors 1`] = `Array []`; -exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): response text 1`] = ` +exports[`https option as an object and allow to pass more options should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object and allow to pass more options should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are array of buffers should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are array of buffers should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": Array [ + "", + ], + "cert": Array [ + "", + ], + "key": Array [ + "", + ], + "passphrase": "webpack-dev-server", + "pfx": Array [ + "", + ], +} +`; + +exports[`https option as an object when ca, pfx, key and cert are array of buffers should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are array of buffers should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are array of buffers should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are array of paths to files should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are array of paths to files should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": Array [ + "", + ], + "cert": Array [ + "", + ], + "key": Array [ + "", + ], + "passphrase": "webpack-dev-server", + "pfx": Array [ + "", + ], +} +`; + +exports[`https option as an object when ca, pfx, key and cert are array of paths to files should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are array of paths to files should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are array of paths to files should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are array of strings should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are array of strings should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": Array [ + "-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEAxAUVLFM+K3XDLQkBi7xt0s1Ip7JoHYDskzUDQNHjjMkUq5kv +C/hf5Ei1J6qruJs3Xqg86Nl4+ed4ynUajAkRRibhp0P1SG1tgPssIK6iC7g8heYu +Dy9WkFuMie0513zjSn6bMEAK5TegxYAWCbaCZX/Fw9bDniabL/zuOv4sf8J4EPhs +EENnH6sUE9HxPUgQmNt1Tbd0j1Cd5PXrSTLyfVPRh0m9QhXTUHuxsse8XSn9U2sw +duxJTWRINmhffYn+O7kbJGI77xYr8u58Rsf3HCMI8DTKZNvQLChvvtLJ9ckyu7Q+ +T8emgklStASm3V2UtnriaK/IQEhgSdxqVRib3QIDA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LZwojQQJmArnIBymTXQTVhaGgKSyOv1qvHLp9L1OJf0/ +Xm+/TqT6ztzhzlftcObdfQZZ5JuoEwlvyrsGFlA3MQKBgQDiQC3KYMG8ViJkWrv6 +XNAFEoAjVEKrtirGWJ66YfQ9KSJ7Zttrd1Y1V1OLtq3z4YMH39wdQ8rOD+yR8mWV +6Tnsxma6yJXAH8uan8iVbxjIZKF1hnvNCxUoxYmWOmTLcEQMzmxvTzAiR+s6R6Uj +9LgGqppt30nM4wnOhOJU6UxqbwKBgQDdy03KidbPZuycJSy1C9AIt0jlrxDsYm+U +fZrB6mHEZcgoZS5GbLKinQCdGcgERa05BXvJmNbfZtT5a37YEnbjsTImIhDiBP5P +nW36/9a3Vg1svd1KP2206/Bh3gfZbgTsQg4YogXgjf0Uzuvw18btgTtLVpVyeuqz +TU3eeF30cwKBgQCN6lvOmapsDEs+T3uhqx4AUH53qp63PmjOSUAnANJGmsq6ROZV +HmHAy6nn9Qpf85BRHCXhZWiMoIhvc3As/EINNtWxS6hC/q6jqp4SvcD50cVFBroY +/16iWGXZCX+37A+DSOfTWgSDPEFcKRx41UOpStHbITgVgEPieo/NWxlHmQKBgQDX +JOLs2RB6V0ilnpnjdPXzvncD9fHgmwvJap24BPeZX3HtXViqD76oZsu1mNCg9EW3 +zk3pnEyyoDlvSIreZerVq4kN3HWsCVP3Pqr0kz9g0CRtmy8RWr28hjHDfXD3xPUZ +iGnMEz7IOHOKv722/liFAprV1cNaLUmFbDNg3jmlaQKBgQDG5WwngPhOHmjTnSml +amfEz9a4yEhQqpqgVNW5wwoXOf6DbjL2m/maJh01giThj7inMcbpkZlIclxD0Eu6 +Lof+ctCeqSAJvaVPmd+nv8Yp26zsF1yM8ax9xXjrIvv9fSbycNveGTDCsNNTiYoW +QyvMqmN1kGy20SZbQDD/fLfqBQ== +-----END PRIVATE KEY----- +", + ], + "passphrase": "webpack-dev-server", + "pfx": Array [ + "", + ], +} +`; + +exports[`https option as an object when ca, pfx, key and cert are array of strings should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are array of strings should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are array of strings should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are buffer should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are buffer should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "", + "cert": "", + "key": "", + "passphrase": "webpack-dev-server", + "pfx": "", +} +`; + +exports[`https option as an object when ca, pfx, key and cert are buffer should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are buffer should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are buffer should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are buffer, key and pfx are objects should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are buffer, key and pfx are objects should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "", + "cert": "", + "key": Array [ + Object { + "pem": "", + }, + ], + "passphrase": "webpack-dev-server", + "pfx": Array [ + Object { + "buf": "", + }, + ], +} +`; + +exports[`https option as an object when ca, pfx, key and cert are buffer, key and pfx are objects should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are buffer, key and pfx are objects should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are buffer, key and pfx are objects should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are paths to files should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are paths to files should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "", + "cert": "", + "key": "", + "passphrase": "webpack-dev-server", + "pfx": "", +} +`; + +exports[`https option as an object when ca, pfx, key and cert are paths to files should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are paths to files should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are paths to files should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are strings should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are strings should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEAxAUVLFM+K3XDLQkBi7xt0s1Ip7JoHYDskzUDQNHjjMkUq5kv +C/hf5Ei1J6qruJs3Xqg86Nl4+ed4ynUajAkRRibhp0P1SG1tgPssIK6iC7g8heYu +Dy9WkFuMie0513zjSn6bMEAK5TegxYAWCbaCZX/Fw9bDniabL/zuOv4sf8J4EPhs +EENnH6sUE9HxPUgQmNt1Tbd0j1Cd5PXrSTLyfVPRh0m9QhXTUHuxsse8XSn9U2sw +duxJTWRINmhffYn+O7kbJGI77xYr8u58Rsf3HCMI8DTKZNvQLChvvtLJ9ckyu7Q+ +T8emgklStASm3V2UtnriaK/IQEhgSdxqVRib3QIDAQABAoIBAGqWKPE1QnT3T+3J +G+ITz9P0dDFbvWltlTZmeSJh/s2q+WZloUNtBxdmwbqT/1QecnkyGgyzVCjvSKsu +CgVjWNVAhysgtNtxRT4BVflffBXLVH2qsBjpsLRGU6EcMXuPGTiEp3YRHNuO6Aj8 +oP8fEsCGPc9DlJMGgxQRAKlrVF8TN/0j6Qk+YpS4MZ0YFQfBY+WdKu04Z8TVTplQ +tTkiGpBI+Oj85jF59aQiizglJgADkAZ6zmbrctm/G9jPxh7JLS2cKI0ECZgK5yAc +pk10E1YWhoCksjr9arxy6fS9TiX9P15vv06k+s7c4c5X7XDm3X0GWeSbqBMJb8q7 +BhZQNzECgYEA4kAtymDBvFYiZFq7+lzQBRKAI1RCq7YqxlieumH0PS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uvw18btgTtLVpVyeuqz +TU3eeF30cwKBgQCN6lvOmapsDEs+T3uhqx4AUH53qp63PmjOSUAnANJGmsq6ROZV +HmHAy6nn9Qpf85BRHCXhZWiMoIhvc3As/EINNtWxS6hC/q6jqp4SvcD50cVFBroY +/16iWGXZCX+37A+DSOfTWgSDPEFcKRx41UOpStHbITgVgEPieo/NWxlHmQKBgQDX +JOLs2RB6V0ilnpnjdPXzvncD9fHgmwvJap24BPeZX3HtXViqD76oZsu1mNCg9EW3 +zk3pnEyyoDlvSIreZerVq4kN3HWsCVP3Pqr0kz9g0CRtmy8RWr28hjHDfXD3xPUZ +iGnMEz7IOHOKv722/liFAprV1cNaLUmFbDNg3jmlaQKBgQDG5WwngPhOHmjTnSml +amfEz9a4yEhQqpqgVNW5wwoXOf6DbjL2m/maJh01giThj7inMcbpkZlIclxD0Eu6 +Lof+ctCeqSAJvaVPmd+nv8Yp26zsF1yM8ax9xXjrIvv9fSbycNveGTDCsNNTiYoW +QyvMqmN1kGy20SZbQDD/fLfqBQ== +-----END PRIVATE KEY----- +", + "passphrase": "webpack-dev-server", + "pfx": "", +} +`; + +exports[`https option as an object when ca, pfx, key and cert are strings should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are strings should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are strings should handle GET request to index route (/): response text 1`] = ` +"Heyo. +" +`; + +exports[`https option as an object when ca, pfx, key and cert are strings, key and pfx are objects should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are strings, key and pfx are objects should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEAxAUVLFM+K3XDLQkBi7xt0s1Ip7JoHYDskzUDQNHjjMkUq5kv +C/hf5Ei1J6qruJs3Xqg86Nl4+ed4ynUajAkRRibhp0P1SG1tgPssIK6iC7g8heYu +Dy9WkFuM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rsf3HCMI8DTKZNvQLChvvtLJ9ckyu7Q+T8emgklS +tASm3V2UtnriaK/IQEhgSdxqVRib3QIDAQABo1AwTjAdBgNVHQ4EFgQUDZBhVKdb +3BRhLIhuuE522Vsul0IwHwYDVR0jBBgwFoAUDZBhVKdb3BRhLIhuuE522Vsul0Iw +DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEABh9WWZwWLgb9/DcTxL72 +6pI96t4jiF79Q+pPefkaIIi0mE6yodWrTAsBQu9I6bNRaEcCSoiXkP2bqskD/UGg +LwUFgSrDOAA3UjdHw3QU5g2NocduG7mcFwA40TB98sOsxsUyYlzSyWzoiQWwPYwb +hek1djuWkqPXsTjlj54PTPN/SjTFmo4p5Ip6nbRf2nOREl7v0rJpGbJvXiCMYyd+ +Zv+j4mRjCGo8ysMR2HjCUGkYReLAgKyyz3M7i8vevJhKslyOmy6Txn4F0nPVumaU +DDIy4xXPW1STWfsmSYJfYW3wa0wk+pJQ3j2cTzkPQQ8gwpvM3U9DJl43uwb37v6I +7Q== +-----END CERTIFICATE----- +", + "key": Array [ + Object { + "pem": "-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDEBRUsUz4rdcMt +CQGLvG3SzUinsmgdgOyTNQNA0eOMyRSrmS8L+F/kSLUnqqu4mzdeqDzo2Xj553jK +dRqMCRFGJuGnQ/VIbW2A+ywgrqILuDyF5i4PL1aQW4yJ7TnXfONKfpswQArlN6DF +gBYJtoJlf8XD1sOeJpsv/O46/ix/wngQ+GwQQ2cfqxQT0fE9SBCY23VNt3SPUJ3k +9etJMvJ9U9GHSb1CFdNQe7Gyx7xdKf1TazB27ElNZEg2aF99if47uRskYjvvFivy +7nxGx/ccIwjwNMpk29AsKG++0sn1yTK7tD5Px6aCSVK0BKbdXZS2euJor8hASGBJ +3GpVGJvdAgMBAAECggEAapYo8TVCdPdP7ckb4hPP0/R0MVu9aW2VNmZ5ImH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DbjL2m/maJh01giThj7inMcbpkZlIclxD0Eu6 +Lof+ctCeqSAJvaVPmd+nv8Yp26zsF1yM8ax9xXjrIvv9fSbycNveGTDCsNNTiYoW +QyvMqmN1kGy20SZbQDD/fLfqBQ== +-----END PRIVATE KEY----- +", + }, + ], + "passphrase": "webpack-dev-server", + "pfx": Array [ + Object { + "buf": "", + }, + ], +} +`; + +exports[`https option as an object when ca, pfx, key and cert are strings, key and pfx are objects should handle GET request to index route (/): page errors 1`] = `Array []`; + +exports[`https option as an object when ca, pfx, key and cert are strings, key and pfx are objects should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when ca, pfx, key and cert are strings, key and pfx are objects should handle GET request to index route (/): response text 1`] = ` "Heyo. " `; -exports[`https option as an object when cacert, pfx, key and cert are paths should handle GET request to index route (/): console messages 1`] = `Array []`; +exports[`https option as an object when cacert and ca, pfx, key and cert are buffer should handle GET request to index route (/): console messages 1`] = `Array []`; + +exports[`https option as an object when cacert and ca, pfx, key and cert are buffer should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "", + "cert": "", + "key": "", + "passphrase": "webpack-dev-server", + "pfx": "", +} +`; -exports[`https option as an object when cacert, pfx, key and cert are paths should handle GET request to index route (/): page errors 1`] = `Array []`; +exports[`https option as an object when cacert and ca, pfx, key and cert are buffer should handle GET request to index route (/): page errors 1`] = `Array []`; -exports[`https option as an object when cacert, pfx, key and cert are paths should handle GET request to index route (/): response status 1`] = `200`; +exports[`https option as an object when cacert and ca, pfx, key and cert are buffer should handle GET request to index route (/): response status 1`] = `200`; -exports[`https option as an object when cacert, pfx, key and cert are paths should handle GET request to index route (/): response text 1`] = ` +exports[`https option as an object when cacert and ca, pfx, key and cert are buffer should handle GET request to index route (/): response text 1`] = ` "Heyo. " `; -exports[`https option as an object when cacert, pfx, key and cert are raw strings should handle GET request to index route (/): console messages 1`] = `Array []`; +exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): console messages 1`] = `Array []`; -exports[`https option as an object when cacert, pfx, key and cert are raw strings should handle GET request to index route (/): page errors 1`] = `Array []`; +exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): https options 1`] = ` +Object { + "ca": "", + "cert": "", + "key": "", + "passphrase": "webpack-dev-server", + "pfx": "", +} +`; -exports[`https option as an object when cacert, pfx, key and cert are raw strings should handle GET request to index route (/): response status 1`] = `200`; +exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): page errors 1`] = `Array []`; -exports[`https option as an object when cacert, pfx, key and cert are raw strings should handle GET request to index route (/): response text 1`] = ` +exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): response status 1`] = `200`; + +exports[`https option as an object when cacert, pfx, key and cert are buffer should handle GET request to index route (/): response text 1`] = ` "Heyo. " `; @@ -50,3 +517,13 @@ exports[`https option should support the "requestCert" option should handle GET "Heyo. " `; + +exports[`https option should support the "requestCert" option should pass options to the 'https.createServer' method: https options 1`] = ` +Object { + "cert": "", + "key": "", + "passphrase": "webpack-dev-server", + "pfx": "", + "requestCert": true, +} +`; diff --git a/test/e2e/https.test.js b/test/e2e/https.test.js index 00647e7dfe..b6e384e13a 100644 --- a/test/e2e/https.test.js +++ b/test/e2e/https.test.js @@ -1,5 +1,6 @@ "use strict"; +const https = require("https"); const path = require("path"); const fs = require("graceful-fs"); const request = require("supertest"); @@ -8,6 +9,7 @@ const Server = require("../../lib/Server"); const config = require("../fixtures/static-config/webpack.config"); const runBrowser = require("../helpers/run-browser"); const { skipTestOnWindows } = require("../helpers/conditional-test"); +const normalizeOptions = require("../helpers/normalize-options"); const port = require("../ports-map")["https-option"]; const httpsCertificateDirectory = path.resolve( @@ -82,9 +84,564 @@ describe("https option", () => { }); }); + describe("as an object when ca, pfx, key and cert are buffer", () => { + let compiler; + let server; + let createServerSpy; + let page; + let browser; + let pageErrors; + let consoleMessages; + + beforeEach(async () => { + compiler = webpack(config); + + createServerSpy = jest.spyOn(https, "createServer"); + + server = new Server( + { + static: { + directory: staticDirectory, + watch: false, + }, + https: { + ca: fs.readFileSync(path.join(httpsCertificateDirectory, "ca.pem")), + pfx: fs.readFileSync( + path.join(httpsCertificateDirectory, "server.pfx") + ), + key: fs.readFileSync( + path.join(httpsCertificateDirectory, "server.key") + ), + cert: fs.readFileSync( + path.join(httpsCertificateDirectory, "server.crt") + ), + passphrase: "webpack-dev-server", + }, + port, + }, + compiler + ); + + await server.start(); + + ({ page, browser } = await runBrowser()); + + pageErrors = []; + consoleMessages = []; + }); + + afterEach(async () => { + createServerSpy.mockRestore(); + + await browser.close(); + await server.stop(); + }); + + it("should handle GET request to index route (/)", async () => { + page + .on("console", (message) => { + consoleMessages.push(message); + }) + .on("pageerror", (error) => { + pageErrors.push(error); + }); + + const response = await page.goto(`https://127.0.0.1:${port}/`, { + waitUntil: "networkidle0", + }); + + expect( + normalizeOptions(createServerSpy.mock.calls[0][0]) + ).toMatchSnapshot("https options"); + expect(response.status()).toMatchSnapshot("response status"); + expect(await response.text()).toMatchSnapshot("response text"); + expect(consoleMessages.map((message) => message.text())).toMatchSnapshot( + "console messages" + ); + expect(pageErrors).toMatchSnapshot("page errors"); + }); + }); + + describe("as an object when ca, pfx, key and cert are array of buffers", () => { + let compiler; + let server; + let createServerSpy; + let page; + let browser; + let pageErrors; + let consoleMessages; + + beforeEach(async () => { + compiler = webpack(config); + + createServerSpy = jest.spyOn(https, "createServer"); + + server = new Server( + { + static: { + directory: staticDirectory, + watch: false, + }, + https: { + ca: [ + fs.readFileSync(path.join(httpsCertificateDirectory, "ca.pem")), + ], + pfx: [ + fs.readFileSync( + path.join(httpsCertificateDirectory, "server.pfx") + ), + ], + key: [ + fs.readFileSync( + path.join(httpsCertificateDirectory, "server.key") + ), + ], + cert: [ + fs.readFileSync( + path.join(httpsCertificateDirectory, "server.crt") + ), + ], + passphrase: "webpack-dev-server", + }, + port, + }, + compiler + ); + + await server.start(); + + ({ page, browser } = await runBrowser()); + + pageErrors = []; + consoleMessages = []; + }); + + afterEach(async () => { + createServerSpy.mockRestore(); + + await browser.close(); + await server.stop(); + }); + + it("should handle GET request to index route (/)", async () => { + page + .on("console", (message) => { + consoleMessages.push(message); + }) + .on("pageerror", (error) => { + pageErrors.push(error); + }); + + const response = await page.goto(`https://127.0.0.1:${port}/`, { + waitUntil: "networkidle0", + }); + + expect( + normalizeOptions(createServerSpy.mock.calls[0][0]) + ).toMatchSnapshot("https options"); + expect(response.status()).toMatchSnapshot("response status"); + expect(await response.text()).toMatchSnapshot("response text"); + expect(consoleMessages.map((message) => message.text())).toMatchSnapshot( + "console messages" + ); + expect(pageErrors).toMatchSnapshot("page errors"); + }); + }); + + describe("as an object when ca, pfx, key and cert are strings", () => { + let compiler; + let server; + let createServerSpy; + let page; + let browser; + let pageErrors; + let consoleMessages; + + beforeEach(async () => { + compiler = webpack(config); + + createServerSpy = jest.spyOn(https, "createServer"); + + server = new Server( + { + static: { + directory: staticDirectory, + watch: false, + }, + https: { + ca: fs + .readFileSync(path.join(httpsCertificateDirectory, "ca.pem")) + .toString(), + // TODO + // pfx can't be string because it is binary format + pfx: fs.readFileSync( + path.join(httpsCertificateDirectory, "server.pfx") + ), + key: fs + .readFileSync(path.join(httpsCertificateDirectory, "server.key")) + .toString(), + cert: fs + .readFileSync(path.join(httpsCertificateDirectory, "server.crt")) + .toString(), + passphrase: "webpack-dev-server", + }, + port, + }, + compiler + ); + + await server.start(); + + ({ page, browser } = await runBrowser()); + + pageErrors = []; + consoleMessages = []; + }); + + afterEach(async () => { + createServerSpy.mockRestore(); + + await browser.close(); + await server.stop(); + }); + + it("should handle GET request to index route (/)", async () => { + page + .on("console", (message) => { + consoleMessages.push(message); + }) + .on("pageerror", (error) => { + pageErrors.push(error); + }); + + const response = await page.goto(`https://127.0.0.1:${port}/`, { + waitUntil: "networkidle0", + }); + + expect( + normalizeOptions(createServerSpy.mock.calls[0][0]) + ).toMatchSnapshot("https options"); + expect(response.status()).toMatchSnapshot("response status"); + expect(await response.text()).toMatchSnapshot("response text"); + expect(consoleMessages.map((message) => message.text())).toMatchSnapshot( + "console messages" + ); + expect(pageErrors).toMatchSnapshot("page errors"); + }); + }); + + describe("as an object when ca, pfx, key and cert are array of strings", () => { + let compiler; + let server; + let createServerSpy; + let page; + let browser; + let pageErrors; + let consoleMessages; + + beforeEach(async () => { + compiler = webpack(config); + + createServerSpy = jest.spyOn(https, "createServer"); + + server = new Server( + { + static: { + directory: staticDirectory, + watch: false, + }, + https: { + ca: [ + fs + .readFileSync(path.join(httpsCertificateDirectory, "ca.pem")) + .toString(), + ], + // pfx can't be string because it is binary format + pfx: [ + fs.readFileSync( + path.join(httpsCertificateDirectory, "server.pfx") + ), + ], + key: [ + fs + .readFileSync( + path.join(httpsCertificateDirectory, "server.key") + ) + .toString(), + ], + cert: [ + fs + .readFileSync( + path.join(httpsCertificateDirectory, "server.crt") + ) + .toString(), + ], + passphrase: "webpack-dev-server", + }, + port, + }, + compiler + ); + + await server.start(); + + ({ page, browser } = await runBrowser()); + + pageErrors = []; + consoleMessages = []; + }); + + afterEach(async () => { + createServerSpy.mockRestore(); + + await browser.close(); + await server.stop(); + }); + + it("should handle GET request to index route (/)", async () => { + page + .on("console", (message) => { + consoleMessages.push(message); + }) + .on("pageerror", (error) => { + pageErrors.push(error); + }); + + const response = await page.goto(`https://127.0.0.1:${port}/`, { + waitUntil: "networkidle0", + }); + + expect( + normalizeOptions(createServerSpy.mock.calls[0][0]) + ).toMatchSnapshot("https options"); + expect(response.status()).toMatchSnapshot("response status"); + expect(await response.text()).toMatchSnapshot("response text"); + expect(consoleMessages.map((message) => message.text())).toMatchSnapshot( + "console messages" + ); + expect(pageErrors).toMatchSnapshot("page errors"); + }); + }); + + describe("as an object when ca, pfx, key and cert are paths to files", () => { + let compiler; + let server; + let createServerSpy; + let page; + let browser; + let pageErrors; + let consoleMessages; + + beforeEach(async () => { + compiler = webpack(config); + + createServerSpy = jest.spyOn(https, "createServer"); + + server = new Server( + { + static: { + directory: staticDirectory, + watch: false, + }, + https: { + ca: path.join(httpsCertificateDirectory, "ca.pem"), + pfx: path.join(httpsCertificateDirectory, "server.pfx"), + key: path.join(httpsCertificateDirectory, "server.key"), + cert: path.join(httpsCertificateDirectory, "server.crt"), + passphrase: "webpack-dev-server", + }, + port, + }, + compiler + ); + + await server.start(); + + ({ page, browser } = await runBrowser()); + + pageErrors = []; + consoleMessages = []; + }); + + afterEach(async () => { + createServerSpy.mockRestore(); + + await browser.close(); + await server.stop(); + }); + + it("should handle GET request to index route (/)", async () => { + page + .on("console", (message) => { + consoleMessages.push(message); + }) + .on("pageerror", (error) => { + pageErrors.push(error); + }); + + const response = await page.goto(`https://127.0.0.1:${port}/`, { + waitUntil: "networkidle0", + }); + + expect( + normalizeOptions(createServerSpy.mock.calls[0][0]) + ).toMatchSnapshot("https options"); + expect(response.status()).toMatchSnapshot("response status"); + expect(await response.text()).toMatchSnapshot("response text"); + expect(consoleMessages.map((message) => message.text())).toMatchSnapshot( + "console messages" + ); + expect(pageErrors).toMatchSnapshot("page errors"); + }); + }); + + describe("as an object when ca, pfx, key and cert are array of paths to files", () => { + let compiler; + let server; + let createServerSpy; + let page; + let browser; + let pageErrors; + let consoleMessages; + + beforeEach(async () => { + compiler = webpack(config); + + createServerSpy = jest.spyOn(https, "createServer"); + + server = new Server( + { + static: { + directory: staticDirectory, + watch: false, + }, + https: { + ca: [path.join(httpsCertificateDirectory, "ca.pem")], + pfx: [path.join(httpsCertificateDirectory, "server.pfx")], + key: [path.join(httpsCertificateDirectory, "server.key")], + cert: [path.join(httpsCertificateDirectory, "server.crt")], + passphrase: "webpack-dev-server", + }, + port, + }, + compiler + ); + + await server.start(); + + ({ page, browser } = await runBrowser()); + + pageErrors = []; + consoleMessages = []; + }); + + afterEach(async () => { + createServerSpy.mockRestore(); + + await browser.close(); + await server.stop(); + }); + + it("should handle GET request to index route (/)", async () => { + page + .on("console", (message) => { + consoleMessages.push(message); + }) + .on("pageerror", (error) => { + pageErrors.push(error); + }); + + const response = await page.goto(`https://127.0.0.1:${port}/`, { + waitUntil: "networkidle0", + }); + + expect( + normalizeOptions(createServerSpy.mock.calls[0][0]) + ).toMatchSnapshot("https options"); + expect(response.status()).toMatchSnapshot("response status"); + expect(await response.text()).toMatchSnapshot("response text"); + expect(consoleMessages.map((message) => message.text())).toMatchSnapshot( + "console messages" + ); + expect(pageErrors).toMatchSnapshot("page errors"); + }); + }); + + describe("as an object when ca, pfx, key and cert are symlinks", () => { + if (skipTestOnWindows("Symlinks are not supported on Windows")) { + return; + } + + let compiler; + let server; + let createServerSpy; + let page; + let browser; + let pageErrors; + let consoleMessages; + + beforeEach(async () => { + compiler = webpack(config); + + createServerSpy = jest.spyOn(https, "createServer"); + + server = new Server( + { + static: { + directory: staticDirectory, + watch: false, + }, + https: { + ca: path.join(httpsCertificateDirectory, "ca-symlink.pem"), + pfx: path.join(httpsCertificateDirectory, "server-symlink.pfx"), + key: path.join(httpsCertificateDirectory, "server-symlink.key"), + cert: path.join(httpsCertificateDirectory, "server-symlink.crt"), + passphrase: "webpack-dev-server", + }, + port, + }, + compiler + ); + + await server.start(); + + ({ page, browser } = await runBrowser()); + + pageErrors = []; + consoleMessages = []; + }); + + afterEach(async () => { + createServerSpy.mockRestore(); + + await browser.close(); + await server.stop(); + }); + + it("should handle GET request to index route (/)", async () => { + page + .on("console", (message) => { + consoleMessages.push(message); + }) + .on("pageerror", (error) => { + pageErrors.push(error); + }); + + const response = await page.goto(`https://127.0.0.1:${port}/`, { + waitUntil: "networkidle0", + }); + + expect(response.status()).toEqual(200); + expect(await response.text()).toContain("Heyo"); + expect(consoleMessages.map((message) => message.text())).toEqual([]); + expect(pageErrors).toEqual([]); + }); + }); + describe("as an object when cacert, pfx, key and cert are buffer", () => { let compiler; let server; + let createServerSpy; let page; let browser; let pageErrors; @@ -93,6 +650,8 @@ describe("https option", () => { beforeEach(async () => { compiler = webpack(config); + createServerSpy = jest.spyOn(https, "createServer"); + server = new Server( { static: { @@ -128,6 +687,8 @@ describe("https option", () => { }); afterEach(async () => { + createServerSpy.mockRestore(); + await browser.close(); await server.stop(); }); @@ -145,21 +706,22 @@ describe("https option", () => { waitUntil: "networkidle0", }); + expect( + normalizeOptions(createServerSpy.mock.calls[0][0]) + ).toMatchSnapshot("https options"); expect(response.status()).toMatchSnapshot("response status"); - expect(await response.text()).toMatchSnapshot("response text"); - expect(consoleMessages.map((message) => message.text())).toMatchSnapshot( "console messages" ); - expect(pageErrors).toMatchSnapshot("page errors"); }); }); - describe("as an object when cacert, pfx, key and cert are paths", () => { + describe("as an object when cacert and ca, pfx, key and cert are buffer", () => { let compiler; let server; + let createServerSpy; let page; let browser; let pageErrors; @@ -168,14 +730,28 @@ describe("https option", () => { beforeEach(async () => { compiler = webpack(config); + createServerSpy = jest.spyOn(https, "createServer"); + server = new Server( { - static: staticDirectory, + static: { + directory: staticDirectory, + watch: false, + }, https: { - cacert: path.join(httpsCertificateDirectory, "ca.pem"), - pfx: path.join(httpsCertificateDirectory, "server.pfx"), - key: path.join(httpsCertificateDirectory, "server.key"), - cert: path.join(httpsCertificateDirectory, "server.crt"), + ca: fs.readFileSync(path.join(httpsCertificateDirectory, "ca.pem")), + cacert: fs.readFileSync( + path.join(httpsCertificateDirectory, "ca.pem") + ), + pfx: fs.readFileSync( + path.join(httpsCertificateDirectory, "server.pfx") + ), + key: fs.readFileSync( + path.join(httpsCertificateDirectory, "server.key") + ), + cert: fs.readFileSync( + path.join(httpsCertificateDirectory, "server.crt") + ), passphrase: "webpack-dev-server", }, port, @@ -192,6 +768,8 @@ describe("https option", () => { }); afterEach(async () => { + createServerSpy.mockRestore(); + await browser.close(); await server.stop(); }); @@ -209,25 +787,22 @@ describe("https option", () => { waitUntil: "networkidle0", }); + expect( + normalizeOptions(createServerSpy.mock.calls[0][0]) + ).toMatchSnapshot("https options"); expect(response.status()).toMatchSnapshot("response status"); - expect(await response.text()).toMatchSnapshot("response text"); - expect(consoleMessages.map((message) => message.text())).toMatchSnapshot( "console messages" ); - expect(pageErrors).toMatchSnapshot("page errors"); }); }); - describe("as an object when cacert, pfx, key and cert are symlinks", () => { - if (skipTestOnWindows("Symlinks are not supported on Windows")) { - return; - } - + describe("as an object when ca, pfx, key and cert are buffer, key and pfx are objects", () => { let compiler; let server; + let createServerSpy; let page; let browser; let pageErrors; @@ -236,6 +811,8 @@ describe("https option", () => { beforeEach(async () => { compiler = webpack(config); + createServerSpy = jest.spyOn(https, "createServer"); + server = new Server( { static: { @@ -243,10 +820,24 @@ describe("https option", () => { watch: false, }, https: { - cacert: path.join(httpsCertificateDirectory, "ca-symlink.pem"), - pfx: path.join(httpsCertificateDirectory, "server-symlink.pfx"), - key: path.join(httpsCertificateDirectory, "server-symlink.key"), - cert: path.join(httpsCertificateDirectory, "server-symlink.crt"), + ca: fs.readFileSync(path.join(httpsCertificateDirectory, "ca.pem")), + pfx: [ + { + buf: fs.readFileSync( + path.join(httpsCertificateDirectory, "server.pfx") + ), + }, + ], + key: [ + { + pem: fs.readFileSync( + path.join(httpsCertificateDirectory, "server.key") + ), + }, + ], + cert: fs.readFileSync( + path.join(httpsCertificateDirectory, "server.crt") + ), passphrase: "webpack-dev-server", }, port, @@ -263,6 +854,8 @@ describe("https option", () => { }); afterEach(async () => { + createServerSpy.mockRestore(); + await browser.close(); await server.stop(); }); @@ -280,19 +873,22 @@ describe("https option", () => { waitUntil: "networkidle0", }); - expect(response.status()).toEqual(200); - - expect(await response.text()).toContain("Heyo"); - - expect(consoleMessages.map((message) => message.text())).toEqual([]); - - expect(pageErrors).toEqual([]); + expect( + normalizeOptions(createServerSpy.mock.calls[0][0]) + ).toMatchSnapshot("https options"); + expect(response.status()).toMatchSnapshot("response status"); + expect(await response.text()).toMatchSnapshot("response text"); + expect(consoleMessages.map((message) => message.text())).toMatchSnapshot( + "console messages" + ); + expect(pageErrors).toMatchSnapshot("page errors"); }); }); - describe("as an object when cacert, pfx, key and cert are raw strings", () => { + describe("as an object when ca, pfx, key and cert are strings, key and pfx are objects", () => { let compiler; let server; + let createServerSpy; let page; let browser; let pageErrors; @@ -301,6 +897,8 @@ describe("https option", () => { beforeEach(async () => { compiler = webpack(config); + createServerSpy = jest.spyOn(https, "createServer"); + server = new Server( { static: { @@ -308,16 +906,26 @@ describe("https option", () => { watch: false, }, https: { - cacert: fs + ca: fs .readFileSync(path.join(httpsCertificateDirectory, "ca.pem")) .toString(), - // pfx can't be string because it is binary format - pfx: fs.readFileSync( - path.join(httpsCertificateDirectory, "server.pfx") - ), - key: fs - .readFileSync(path.join(httpsCertificateDirectory, "server.key")) - .toString(), + pfx: [ + { + // pfx can't be string because it is binary format + buf: fs.readFileSync( + path.join(httpsCertificateDirectory, "server.pfx") + ), + }, + ], + key: [ + { + pem: fs + .readFileSync( + path.join(httpsCertificateDirectory, "server.key") + ) + .toString(), + }, + ], cert: fs .readFileSync(path.join(httpsCertificateDirectory, "server.crt")) .toString(), @@ -337,6 +945,8 @@ describe("https option", () => { }); afterEach(async () => { + createServerSpy.mockRestore(); + await browser.close(); await server.stop(); }); @@ -354,14 +964,93 @@ describe("https option", () => { waitUntil: "networkidle0", }); + expect( + normalizeOptions(createServerSpy.mock.calls[0][0]) + ).toMatchSnapshot("https options"); expect(response.status()).toMatchSnapshot("response status"); - expect(await response.text()).toMatchSnapshot("response text"); - expect(consoleMessages.map((message) => message.text())).toMatchSnapshot( "console messages" ); + expect(pageErrors).toMatchSnapshot("page errors"); + }); + }); + + describe("as an object and allow to pass more options", () => { + let compiler; + let server; + let createServerSpy; + let page; + let browser; + let pageErrors; + let consoleMessages; + + beforeEach(async () => { + compiler = webpack(config); + + createServerSpy = jest.spyOn(https, "createServer"); + + server = new Server( + { + static: { + directory: staticDirectory, + watch: false, + }, + https: { + minVersion: "TLSv1.1", + ca: fs.readFileSync(path.join(httpsCertificateDirectory, "ca.pem")), + pfx: fs.readFileSync( + path.join(httpsCertificateDirectory, "server.pfx") + ), + key: fs.readFileSync( + path.join(httpsCertificateDirectory, "server.key") + ), + cert: fs.readFileSync( + path.join(httpsCertificateDirectory, "server.crt") + ), + passphrase: "webpack-dev-server", + }, + port, + }, + compiler + ); + + await server.start(); + + ({ page, browser } = await runBrowser()); + pageErrors = []; + consoleMessages = []; + }); + + afterEach(async () => { + createServerSpy.mockRestore(); + + await browser.close(); + await server.stop(); + }); + + it("should handle GET request to index route (/)", async () => { + page + .on("console", (message) => { + consoleMessages.push(message); + }) + .on("pageerror", (error) => { + pageErrors.push(error); + }); + + const response = await page.goto(`https://127.0.0.1:${port}/`, { + waitUntil: "networkidle0", + }); + + expect( + normalizeOptions(createServerSpy.mock.calls[0][0]) + ).toMatchSnapshot("https options"); + expect(response.status()).toMatchSnapshot("response status"); + expect(await response.text()).toMatchSnapshot("response text"); + expect(consoleMessages.map((message) => message.text())).toMatchSnapshot( + "console messages" + ); expect(pageErrors).toMatchSnapshot("page errors"); }); }); @@ -372,11 +1061,14 @@ describe("https option", () => { describe('should support the "requestCert" option', () => { let compiler; let server; + let createServerSpy; let req; beforeEach(async () => { compiler = webpack(config); + createServerSpy = jest.spyOn(https, "createServer"); + server = new Server( { static: { @@ -407,9 +1099,17 @@ describe("https option", () => { }); afterEach(async () => { + createServerSpy.mockRestore(); + await server.stop(); }); + it("should pass options to the 'https.createServer' method", async () => { + expect( + normalizeOptions(createServerSpy.mock.calls[0][0]) + ).toMatchSnapshot("https options"); + }); + it("should handle GET request to index route (/)", async () => { const response = await req.get("/"); diff --git a/test/helpers/normalize-options.js b/test/helpers/normalize-options.js new file mode 100644 index 0000000000..64814dc412 --- /dev/null +++ b/test/helpers/normalize-options.js @@ -0,0 +1,38 @@ +"use strict"; + +function normalizeOptions(options) { + const normalizedOptions = {}; + + // eslint-disable-next-line guard-for-in + for (const propertyName in options) { + let value = options[propertyName]; + + if (Array.isArray(value)) { + value = value.map((item) => { + if (Buffer.isBuffer(item)) { + return ""; + } else if ( + typeof item.pem !== "undefined" && + Buffer.isBuffer(item.pem) + ) { + item.pem = ""; + } else if ( + typeof item.buf !== "undefined" && + Buffer.isBuffer(item.buf) + ) { + item.buf = ""; + } + + return item; + }); + } else if (Buffer.isBuffer(value)) { + value = ""; + } + + normalizedOptions[propertyName] = value; + } + + return normalizedOptions; +} + +module.exports = normalizeOptions; diff --git a/test/validate-options.test.js b/test/validate-options.test.js index d29126def2..1711c59e7d 100644 --- a/test/validate-options.test.js +++ b/test/validate-options.test.js @@ -192,6 +192,60 @@ const tests = { success: [ false, true, + { + ca: readFileSync( + path.join(httpsCertificateDirectory, "ca.pem") + ).toString(), + pfx: readFileSync( + path.join(httpsCertificateDirectory, "server.pfx") + ).toString(), + key: readFileSync( + path.join(httpsCertificateDirectory, "server.key") + ).toString(), + cert: readFileSync( + path.join(httpsCertificateDirectory, "server.crt") + ).toString(), + passphrase: "webpack-dev-server", + }, + { + ca: [ + readFileSync( + path.join(httpsCertificateDirectory, "ca.pem") + ).toString(), + ], + pfx: [ + readFileSync( + path.join(httpsCertificateDirectory, "server.pfx") + ).toString(), + ], + key: [ + readFileSync( + path.join(httpsCertificateDirectory, "server.key") + ).toString(), + ], + cert: [ + readFileSync( + path.join(httpsCertificateDirectory, "server.crt") + ).toString(), + ], + passphrase: "webpack-dev-server", + }, + { + ca: readFileSync(path.join(httpsCertificateDirectory, "ca.pem")), + pfx: readFileSync(path.join(httpsCertificateDirectory, "server.pfx")), + key: readFileSync(path.join(httpsCertificateDirectory, "server.key")), + cert: readFileSync(path.join(httpsCertificateDirectory, "server.crt")), + passphrase: "webpack-dev-server", + }, + { + ca: [readFileSync(path.join(httpsCertificateDirectory, "ca.pem"))], + pfx: [readFileSync(path.join(httpsCertificateDirectory, "server.pfx"))], + key: [readFileSync(path.join(httpsCertificateDirectory, "server.key"))], + cert: [ + readFileSync(path.join(httpsCertificateDirectory, "server.crt")), + ], + passphrase: "webpack-dev-server", + }, { cacert: path.join(httpsCertificateDirectory, "ca.pem"), key: path.join(httpsCertificateDirectory, "server.key"), @@ -200,6 +254,14 @@ const tests = { requestCert: true, passphrase: "webpack-dev-server", }, + { + cacert: [path.join(httpsCertificateDirectory, "ca.pem")], + key: [path.join(httpsCertificateDirectory, "server.key")], + pfx: [path.join(httpsCertificateDirectory, "server.pfx")], + cert: [path.join(httpsCertificateDirectory, "server.crt")], + requestCert: true, + passphrase: "webpack-dev-server", + }, { cacert: readFileSync(path.join(httpsCertificateDirectory, "ca.pem")), pfx: readFileSync(path.join(httpsCertificateDirectory, "server.pfx")), @@ -207,12 +269,36 @@ const tests = { cert: readFileSync(path.join(httpsCertificateDirectory, "server.crt")), passphrase: "webpack-dev-server", }, + { + minVersion: "TLSv1.1", + ca: readFileSync(path.join(httpsCertificateDirectory, "ca.pem")), + pfx: readFileSync(path.join(httpsCertificateDirectory, "server.pfx")), + key: readFileSync(path.join(httpsCertificateDirectory, "server.key")), + cert: readFileSync(path.join(httpsCertificateDirectory, "server.crt")), + passphrase: "webpack-dev-server", + }, + { + ca: readFileSync(path.join(httpsCertificateDirectory, "ca.pem")), + pfx: [ + { + buf: readFileSync( + path.join(httpsCertificateDirectory, "server.pfx") + ), + }, + ], + key: [ + { + pem: readFileSync( + path.join(httpsCertificateDirectory, "server.key") + ), + }, + ], + cert: readFileSync(path.join(httpsCertificateDirectory, "server.crt")), + passphrase: "webpack-dev-server", + }, ], failure: [ "", - { - foo: "bar", - }, { key: 10, },