Skip to content

Commit 1f04b1a

Browse files
authored
test: dev server 4 migration (#2693)
1 parent 3d8c8ff commit 1f04b1a

18 files changed

Lines changed: 1421 additions & 1099 deletions

.github/workflows/nodejs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ jobs:
5757
node-version: [10.x, 12.x, 14.x]
5858
webpack-version: [4, latest]
5959
dev-server-version: [latest, next]
60+
exclude:
61+
- node-version: 10.x
62+
dev-server-version: next
6063

6164
steps:
6265
- uses: actions/checkout@v2

test/help/__snapshots__/help.test.js.snap.devServer4.webpack4

Lines changed: 592 additions & 488 deletions
Large diffs are not rendered by default.

test/help/__snapshots__/help.test.js.snap.devServer4.webpack5

Lines changed: 600 additions & 496 deletions
Large diffs are not rendered by default.

test/serve/basic/__snapshots__/serve-basic.test.js.snap.devServer4.webpack4

Lines changed: 65 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -74,62 +74,73 @@ exports[`basic serve usage should shoe help information for serve: stdout 1`] =
7474
Run the webpack dev server.
7575

7676
Options:
77-
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
78-
--config-name <value...> Name of the configuration to use.
79-
-m, --merge Merge two or more configurations using 'webpack-merge'.
80-
--env <value...> Environment passed to the configuration when it is a function.
81-
--node-env <value> Sets process.env.NODE_ENV to the specified value.
82-
--progress [value] Print compilation progress during build.
83-
-j, --json [value] Prints result as JSON or store it in a file.
84-
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
85-
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
86-
-t, --target <value> Sets the build target e.g. node.
87-
-d, --devtool <value> Determine source maps to use.
88-
--no-devtool Do not generate source maps.
89-
--mode <value> Defines the mode to pass to webpack.
90-
--name <value> Name of the configuration. Used when loading multiple configurations.
91-
--stats [value] It instructs webpack on how to treat the stats e.g. verbose.
92-
--no-stats Disable stats output.
93-
--watch-options-stdin Stop watching when stdin stream has ended.
94-
--no-watch-options-stdin Do not stop watching when stdin stream has ended.
95-
--host <value> The hostname/ip address the server will bind to.
96-
--port <value> The port server will listen to.
97-
--static [value...] A directory to serve static content from.
98-
--no-static Negative 'static' option.
99-
--live-reload Enables live reloading on changing files.
100-
--no-live-reload Disables live reloading on changing files.
101-
--https Use HTTPS protocol.
102-
--no-https Do not use HTTPS protocol.
103-
--http2 Use HTTP/2, must be used with HTTPS.
104-
--no-http2 Do not use HTTP/2.
105-
--bonjour Broadcasts the server via ZeroConf networking on start.
106-
--no-bonjour Do not broadcast the server via ZeroConf networking on start.
107-
--client-progress Print compilation progress in percentage in the browser.
108-
--no-client-progress Do not print compilation progress in percentage in the browser.
109-
--client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings.
110-
--no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings.
111-
--setup-exit-signals Close and exit the process on SIGINT and SIGTERM.
112-
--no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM.
113-
--open [value...] Open the default browser.
114-
--no-open Do not open the default browser.
115-
--open-app <value> Open specified browser.
116-
--open-target [value...] Open specified route in browser.
117-
--no-open-target Do not open specified route in browser.
118-
--client-logging <value> Log level in the browser (none, error, warn, info, log, verbose).
119-
--history-api-fallback Fallback to /index.html for Single Page Applications.
120-
--no-history-api-fallback Do not fallback to /index.html for Single Page Applications.
121-
--compress Enable gzip compression.
122-
--no-compress Disable gzip compression.
123-
--public <value> The public hostname/ip address of the server.
124-
--firewall [value...] Enable firewall or set hosts that are allowed to access the dev server.
125-
--no-firewall Disable firewall.
126-
--watch-files <value...> Watch static files for file changes.
77+
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
78+
--config-name <value...> Name of the configuration to use.
79+
-m, --merge Merge two or more configurations using 'webpack-merge'.
80+
--env <value...> Environment passed to the configuration when it is a function.
81+
--node-env <value> Sets process.env.NODE_ENV to the specified value.
82+
--progress [value] Print compilation progress during build.
83+
-j, --json [value] Prints result as JSON or store it in a file.
84+
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
85+
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
86+
-t, --target <value> Sets the build target e.g. node.
87+
-d, --devtool <value> Determine source maps to use.
88+
--no-devtool Do not generate source maps.
89+
--mode <value> Defines the mode to pass to webpack.
90+
--name <value> Name of the configuration. Used when loading multiple configurations.
91+
--stats [value] It instructs webpack on how to treat the stats e.g. verbose.
92+
--no-stats Disable stats output.
93+
--watch-options-stdin Stop watching when stdin stream has ended.
94+
--no-watch-options-stdin Do not stop watching when stdin stream has ended.
95+
--host <value> The hostname/ip address the server will bind to.
96+
--port <value> The port server will listen to.
97+
--static [value...] A directory to serve static content from.
98+
--no-static Negative 'static' option.
99+
--static-directory <value> Directory for static contents.
100+
--static-public-path <value...> The bundled files will be available in the browser under this path.
101+
--static-serve-index Tells dev-server to use serveIndex middleware.
102+
--no-static-serve-index Do not tell dev-server to use serveIndex middleware.
103+
--static-watch Watch for files in static content directory.
104+
--no-static-watch Do not watch for files in static content directory.
105+
--live-reload Enables live reloading on changing files.
106+
--no-live-reload Disables live reloading on changing files.
107+
--https Use HTTPS protocol.
108+
--no-https Do not use HTTPS protocol.
109+
--https-passphrase <value> Passphrase for a pfx file.
110+
--https-key <value> Path to an SSL key.
111+
--https-pfx <value> Path to an SSL pfx file.
112+
--https-cert <value> Path to an SSL certificate.
113+
--https-cacert <value> Path to an SSL CA certificate.
114+
--https-request-cert Request for an SSL certificate.
115+
--no-https-request-cert Do not request for an SSL certificate.
116+
--http2 Use HTTP/2, must be used with HTTPS.
117+
--no-http2 Do not use HTTP/2.
118+
--bonjour Broadcasts the server via ZeroConf networking on start.
119+
--no-bonjour Do not broadcast the server via ZeroConf networking on start.
120+
--client-progress Print compilation progress in percentage in the browser.
121+
--no-client-progress Do not print compilation progress in percentage in the browser.
122+
--client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings.
123+
--no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings.
124+
--open [value...] Open the default browser.
125+
--no-open Do not open the default browser.
126+
--open-app <value> Open specified browser.
127+
--open-target [value...] Open specified route in browser.
128+
--no-open-target Do not open specified route in browser.
129+
--client-logging <value> Log level in the browser (none, error, warn, info, log, verbose).
130+
--history-api-fallback Fallback to /index.html for Single Page Applications.
131+
--no-history-api-fallback Do not fallback to /index.html for Single Page Applications.
132+
--compress Enable gzip compression.
133+
--no-compress Disable gzip compression.
134+
--public <value> The public hostname/ip address of the server.
135+
--firewall [value...] Enable firewall or set hosts that are allowed to access the dev server.
136+
--no-firewall Disable firewall.
137+
--watch-files <value...> Watch static files for file changes.
127138

128139
Global options:
129-
--color Enable colors on console.
130-
--no-color Disable colors on console.
131-
-v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
132-
-h, --help [verbose] Display help for commands and options.
140+
--color Enable colors on console.
141+
--no-color Disable colors on console.
142+
-v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
143+
-h, --help [verbose] Display help for commands and options.
133144

134145
To see list of all supported commands and options run 'webpack --help=verbose'.
135146

test/serve/basic/__snapshots__/serve-basic.test.js.snap.devServer4.webpack5

Lines changed: 66 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -74,63 +74,74 @@ exports[`basic serve usage should shoe help information for serve: stdout 1`] =
7474
Run the webpack dev server.
7575

7676
Options:
77-
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
78-
--config-name <value...> Name of the configuration to use.
79-
-m, --merge Merge two or more configurations using 'webpack-merge'.
80-
--env <value...> Environment passed to the configuration when it is a function.
81-
--node-env <value> Sets process.env.NODE_ENV to the specified value.
82-
--progress [value] Print compilation progress during build.
83-
-j, --json [value] Prints result as JSON or store it in a file.
84-
-d, --devtool <value> Determine source maps to use.
85-
--no-devtool Do not generate source maps.
86-
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
87-
--mode <value> Defines the mode to pass to webpack.
88-
--name <value> Name of the configuration. Used when loading multiple configurations.
89-
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
90-
--stats [value] It instructs webpack on how to treat the stats e.g. verbose.
91-
--no-stats Disable stats output.
92-
-t, --target <value...> Sets the build target e.g. node.
93-
--no-target Negative 'target' option.
94-
--watch-options-stdin Stop watching when stdin stream has ended.
95-
--no-watch-options-stdin Do not stop watching when stdin stream has ended.
96-
--host <value> The hostname/ip address the server will bind to.
97-
--port <value> The port server will listen to.
98-
--static [value...] A directory to serve static content from.
99-
--no-static Negative 'static' option.
100-
--live-reload Enables live reloading on changing files.
101-
--no-live-reload Disables live reloading on changing files.
102-
--https Use HTTPS protocol.
103-
--no-https Do not use HTTPS protocol.
104-
--http2 Use HTTP/2, must be used with HTTPS.
105-
--no-http2 Do not use HTTP/2.
106-
--bonjour Broadcasts the server via ZeroConf networking on start.
107-
--no-bonjour Do not broadcast the server via ZeroConf networking on start.
108-
--client-progress Print compilation progress in percentage in the browser.
109-
--no-client-progress Do not print compilation progress in percentage in the browser.
110-
--client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings.
111-
--no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings.
112-
--setup-exit-signals Close and exit the process on SIGINT and SIGTERM.
113-
--no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM.
114-
--open [value...] Open the default browser.
115-
--no-open Do not open the default browser.
116-
--open-app <value> Open specified browser.
117-
--open-target [value...] Open specified route in browser.
118-
--no-open-target Do not open specified route in browser.
119-
--client-logging <value> Log level in the browser (none, error, warn, info, log, verbose).
120-
--history-api-fallback Fallback to /index.html for Single Page Applications.
121-
--no-history-api-fallback Do not fallback to /index.html for Single Page Applications.
122-
--compress Enable gzip compression.
123-
--no-compress Disable gzip compression.
124-
--public <value> The public hostname/ip address of the server.
125-
--firewall [value...] Enable firewall or set hosts that are allowed to access the dev server.
126-
--no-firewall Disable firewall.
127-
--watch-files <value...> Watch static files for file changes.
77+
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
78+
--config-name <value...> Name of the configuration to use.
79+
-m, --merge Merge two or more configurations using 'webpack-merge'.
80+
--env <value...> Environment passed to the configuration when it is a function.
81+
--node-env <value> Sets process.env.NODE_ENV to the specified value.
82+
--progress [value] Print compilation progress during build.
83+
-j, --json [value] Prints result as JSON or store it in a file.
84+
-d, --devtool <value> Determine source maps to use.
85+
--no-devtool Do not generate source maps.
86+
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
87+
--mode <value> Defines the mode to pass to webpack.
88+
--name <value> Name of the configuration. Used when loading multiple configurations.
89+
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
90+
--stats [value] It instructs webpack on how to treat the stats e.g. verbose.
91+
--no-stats Disable stats output.
92+
-t, --target <value...> Sets the build target e.g. node.
93+
--no-target Negative 'target' option.
94+
--watch-options-stdin Stop watching when stdin stream has ended.
95+
--no-watch-options-stdin Do not stop watching when stdin stream has ended.
96+
--host <value> The hostname/ip address the server will bind to.
97+
--port <value> The port server will listen to.
98+
--static [value...] A directory to serve static content from.
99+
--no-static Negative 'static' option.
100+
--static-directory <value> Directory for static contents.
101+
--static-public-path <value...> The bundled files will be available in the browser under this path.
102+
--static-serve-index Tells dev-server to use serveIndex middleware.
103+
--no-static-serve-index Do not tell dev-server to use serveIndex middleware.
104+
--static-watch Watch for files in static content directory.
105+
--no-static-watch Do not watch for files in static content directory.
106+
--live-reload Enables live reloading on changing files.
107+
--no-live-reload Disables live reloading on changing files.
108+
--https Use HTTPS protocol.
109+
--no-https Do not use HTTPS protocol.
110+
--https-passphrase <value> Passphrase for a pfx file.
111+
--https-key <value> Path to an SSL key.
112+
--https-pfx <value> Path to an SSL pfx file.
113+
--https-cert <value> Path to an SSL certificate.
114+
--https-cacert <value> Path to an SSL CA certificate.
115+
--https-request-cert Request for an SSL certificate.
116+
--no-https-request-cert Do not request for an SSL certificate.
117+
--http2 Use HTTP/2, must be used with HTTPS.
118+
--no-http2 Do not use HTTP/2.
119+
--bonjour Broadcasts the server via ZeroConf networking on start.
120+
--no-bonjour Do not broadcast the server via ZeroConf networking on start.
121+
--client-progress Print compilation progress in percentage in the browser.
122+
--no-client-progress Do not print compilation progress in percentage in the browser.
123+
--client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings.
124+
--no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings.
125+
--open [value...] Open the default browser.
126+
--no-open Do not open the default browser.
127+
--open-app <value> Open specified browser.
128+
--open-target [value...] Open specified route in browser.
129+
--no-open-target Do not open specified route in browser.
130+
--client-logging <value> Log level in the browser (none, error, warn, info, log, verbose).
131+
--history-api-fallback Fallback to /index.html for Single Page Applications.
132+
--no-history-api-fallback Do not fallback to /index.html for Single Page Applications.
133+
--compress Enable gzip compression.
134+
--no-compress Disable gzip compression.
135+
--public <value> The public hostname/ip address of the server.
136+
--firewall [value...] Enable firewall or set hosts that are allowed to access the dev server.
137+
--no-firewall Disable firewall.
138+
--watch-files <value...> Watch static files for file changes.
128139

129140
Global options:
130-
--color Enable colors on console.
131-
--no-color Disable colors on console.
132-
-v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
133-
-h, --help [verbose] Display help for commands and options.
141+
--color Enable colors on console.
142+
--no-color Disable colors on console.
143+
-v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
144+
-h, --help [verbose] Display help for commands and options.
134145

135146
To see list of all supported commands and options run 'webpack --help=verbose'.
136147

test/serve/basic/function-with-argv.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin');
2+
const { isDevServer4 } = require('../../utils/test-utils');
23

34
module.exports = (env, argv) => {
45
console.log(argv);
@@ -7,5 +8,12 @@ module.exports = (env, argv) => {
78
mode: 'development',
89
devtool: false,
910
plugins: [new WebpackCLITestPlugin(['mode'], false, 'hooks.compilation.taps')],
11+
devServer: isDevServer4
12+
? {
13+
client: {
14+
logging: 'info',
15+
},
16+
}
17+
: {},
1018
};
1119
};

0 commit comments

Comments
 (0)