From f5994931107a63746f8c665176b0529c434effd6 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Wed, 7 Jul 2021 13:07:29 +0530 Subject: [PATCH] test: fix --- .../help.test.js.snap.devServer3.webpack4 | 13 ------------- .../help.test.js.snap.devServer4.webpack4 | 13 ------------- test/help/help.test.js | 12 ++++++++---- 3 files changed, 8 insertions(+), 30 deletions(-) diff --git a/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 b/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 index 893a4280c37..5e9c6cb436b 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 +++ b/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 @@ -2515,19 +2515,6 @@ CLI documentation: https://webpack.js.org/api/cli/. Made with ♥ by the webpack team." `; -exports[`help should show help information using the "help --cache-type" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help --cache-type" option: stdout 1`] = ` -"Usage: webpack --cache-type -Description: In memory caching. Filesystem caching. - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - exports[`help should show help information using the "help --color" option: stderr 1`] = `""`; exports[`help should show help information using the "help --color" option: stdout 1`] = ` diff --git a/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 b/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 index ca32b7ec7c2..170369e3ff3 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 +++ b/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 @@ -2645,19 +2645,6 @@ CLI documentation: https://webpack.js.org/api/cli/. Made with ♥ by the webpack team." `; -exports[`help should show help information using the "help --cache-type" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help --cache-type" option: stdout 1`] = ` -"Usage: webpack --cache-type -Description: In memory caching. Filesystem caching. - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - exports[`help should show help information using the "help --color" option: stderr 1`] = `""`; exports[`help should show help information using the "help --color" option: stdout 1`] = ` diff --git a/test/help/help.test.js b/test/help/help.test.js index d7ef6cda29c..f7f556bcf8e 100644 --- a/test/help/help.test.js +++ b/test/help/help.test.js @@ -1,6 +1,6 @@ "use strict"; -const { run, normalizeStderr, normalizeStdout } = require("../utils/test-utils"); +const { run, normalizeStderr, normalizeStdout, isWebpack5 } = require("../utils/test-utils"); describe("help", () => { it('should show help information using the "--help" option', async () => { @@ -245,9 +245,13 @@ describe("help", () => { it('should show help information using the "help --cache-type" option', async () => { const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--cache-type"]); - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); + if (isWebpack5) { + expect(exitCode).toBe(0); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); + } else { + expect(exitCode).toBe(2); + } }); it('should show help information using the "help --no-stats" option', async () => {