diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 64333053e7e..16bc608cdb8 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -62,13 +62,6 @@ jobs: shard: ["1/4", "2/4", "3/4", "4/4"] webpack-version: [latest] dev-server-version: [latest] - include: - - node-version: 18.x - os: ubuntu-latest - dev-server-version: 4 - - node-version: 20.x - os: ubuntu-latest - dev-server-version: 4 steps: - uses: actions/checkout@v4 @@ -89,10 +82,6 @@ jobs: - name: Install dependencies run: yarn --frozen-lockfile --ignore-engines --ignore-scripts - - name: Install webpack-dev-server ${{ matrix.dev-server-version }} - if: matrix.dev-server-version == '4' - run: yarn add -W -D webpack-dev-server@${{ matrix.dev-server-version }} --ignore-engines --ignore-scripts - - name: Prepare environment for tests run: yarn build:ci diff --git a/test/serve/basic/__snapshots__/serve-basic.test.js.snap.devServer4.webpack5 b/test/serve/basic/__snapshots__/serve-basic.test.js.snap.devServer4.webpack5 deleted file mode 100644 index ae23a51e47a..00000000000 --- a/test/serve/basic/__snapshots__/serve-basic.test.js.snap.devServer4.webpack5 +++ /dev/null @@ -1,253 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`basic serve usage should log an error on unknown flag: stderr 1`] = ` -"[webpack-cli] Error: Unknown option '--unknown-flag' -[webpack-cli] Run 'webpack --help' to see available commands and options" -`; - -exports[`basic serve usage should log an error on unknown flag: stdout 1`] = `""`; - -exports[`basic serve usage should log error on using '--watch' flag with serve: stderr 1`] = ` -"[webpack-cli] No need to use the 'serve' command together with '{ watch: true | false }' or '--watch'/'--no-watch' configuration, it does not make sense. - [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should log warning on using '-w' alias with serve: stderr 1`] = ` -"[webpack-cli] No need to use the 'serve' command together with '{ watch: true | false }' or '--watch'/'--no-watch' configuration, it does not make sense. - [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should not start dev server when supplied false #1: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should respect the "publicPath" option from configuration (from the "devServer" options): stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should respect the "publicPath" option from configuration using multi compiler mode (from the "devServer" options): stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should respect the "publicPath" option from configuration using multi compiler mode: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should respect the "publicPath" option from configuration: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should throw error when same ports in multicompiler: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory -[webpack-cli] Error: Unique ports must be specified for each devServer option in your webpack configuration. Alternatively, run only 1 devServer config using the --config-name flag to specify your desired config. - at stack" -`; - -exports[`basic serve usage should work and log warning on the 'watch' option in a configuration: stderr 1`] = ` -"[webpack-cli] No need to use the 'serve' command together with '{ watch: true | false }' or '--watch'/'--no-watch' configuration, it does not make sense. - [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work in multi compiler mode: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with "--hot" and "--port" options: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with entries syntax: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--client-log-level" option: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--config" and "--env" options and expose dev server options: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--config" and "--env" options: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--config" option: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--hot" option using the "only" value: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--hot" option: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--mode" option #2: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--mode" option #3: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--mode" option: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--no-hot" option: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--open" option: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--output-public-path" option: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--port" option: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--stats verbose" option: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "--stats" option: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the "stats" option in config: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work with the default "publicPath" option: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; - -exports[`basic serve usage should work: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/basic/public' directory" -`; diff --git a/test/serve/invalid-schema/__snapshots__/invalid-schema.test.js.snap.devServer4.webpack5 b/test/serve/invalid-schema/__snapshots__/invalid-schema.test.js.snap.devServer4.webpack5 deleted file mode 100644 index 02005e8bcbc..00000000000 --- a/test/serve/invalid-schema/__snapshots__/invalid-schema.test.js.snap.devServer4.webpack5 +++ /dev/null @@ -1,30 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`invalid schema should log webpack error and exit process on invalid config: stderr 1`] = ` -"[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - - configuration.mode should be one of these: - "development" | "production" | "none" - -> Enable production optimizations or development hints." -`; - -exports[`invalid schema should log webpack error and exit process on invalid config: stdout 1`] = `""`; - -exports[`invalid schema should log webpack error and exit process on invalid flag: stderr 1`] = ` -"[webpack-cli] Invalid value 'Yukihira' for the '--mode' option -[webpack-cli] Expected: 'development | production | none'" -`; - -exports[`invalid schema should log webpack error and exit process on invalid flag: stdout 1`] = `""`; - -exports[`invalid schema should log webpack-dev-server error and exit process on invalid config: stderr 1`] = ` -"[webpack-cli] Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - - options.bonjour should be one of these: - boolean | object { … } - -> Allows to broadcasts dev server via ZeroConf networking on start. - -> Read more - at stack - -> Options for bonjour. - -> Read more at https://github.com/watson/bonjour#initializing" -`; - -exports[`invalid schema should log webpack-dev-server error and exit process on invalid config: stdout 1`] = `""`; diff --git a/test/serve/serve-variable/__snapshots__/serve-variable.test.js.snap.devServer4.webpack5 b/test/serve/serve-variable/__snapshots__/serve-variable.test.js.snap.devServer4.webpack5 deleted file mode 100644 index 6f2389a60ea..00000000000 --- a/test/serve/serve-variable/__snapshots__/serve-variable.test.js.snap.devServer4.webpack5 +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`serve variable compiles without flags and export variable 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/serve-variable/public' directory" -`; diff --git a/test/serve/with-custom-port/__snapshots__/serve-custom-config.test.js.snap.devServer4.webpack5 b/test/serve/with-custom-port/__snapshots__/serve-custom-config.test.js.snap.devServer4.webpack5 deleted file mode 100644 index 346c45be6b2..00000000000 --- a/test/serve/with-custom-port/__snapshots__/serve-custom-config.test.js.snap.devServer4.webpack5 +++ /dev/null @@ -1,33 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`serve with devServer in config Passing hot flag works alongside other server config: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/with-custom-port/public' directory" -`; - -exports[`serve with devServer in config Port flag should override the config port: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/with-custom-port/public' directory" -`; - -exports[`serve with devServer in config Should pick up the host and port from config: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/with-custom-port/public' directory" -`; - -exports[`serve with devServer in config works fine when no-hot flag is passed alongside other server config: stderr 1`] = ` -" [webpack-dev-server] Project is running at: - [webpack-dev-server] Loopback: http://localhost:/ - [webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:/ - [webpack-dev-server] On Your Network (IPv6): http://[x:x:x:x:x:x:x:x]:/ - [webpack-dev-server] Content not from webpack is served from '/test/serve/with-custom-port/public' directory" -`;