From 05636b70f50338ac122685821f757435596245e2 Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Fri, 25 Dec 2020 19:04:08 +0300 Subject: [PATCH] tests: core options for serve --- test/serve/basic/serve-basic.test.js | 27 +++++++++++++++++++++++++++ test/serve/basic/webpack.config.js | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/test/serve/basic/serve-basic.test.js b/test/serve/basic/serve-basic.test.js index dff4a541882..16549148b67 100644 --- a/test/serve/basic/serve-basic.test.js +++ b/test/serve/basic/serve-basic.test.js @@ -34,6 +34,33 @@ describe('basic serve usage', () => { expect(stdout).not.toContain('HotModuleReplacementPlugin'); }); + it('should work with the "--mode" option', async () => { + const { stderr, stdout } = await runServe([], __dirname); + + expect(stderr).toBeFalsy(); + expect(stdout).toContain('development'); + expect(stdout).toContain('main.js'); + expect(stdout).not.toContain('HotModuleReplacementPlugin'); + }); + + it('should work with the "--mode" option #2', async () => { + const { stderr, stdout } = await runServe(['--mode', 'production'], __dirname); + + expect(stderr).toBeFalsy(); + expect(stdout).toContain('production'); + expect(stdout).toContain('main.js'); + expect(stdout).not.toContain('HotModuleReplacementPlugin'); + }); + + it('should work with the "--mode" option #2', async () => { + const { stderr, stdout } = await runServe(['--mode', 'development'], __dirname); + + expect(stderr).toBeFalsy(); + expect(stdout).toContain('development'); + expect(stdout).toContain('main.js'); + expect(stdout).not.toContain('HotModuleReplacementPlugin'); + }); + it('should work with flags', async () => { const { stderr, stdout } = await runServe(['--hot'], __dirname); diff --git a/test/serve/basic/webpack.config.js b/test/serve/basic/webpack.config.js index 39850bab850..98b22edfdc9 100644 --- a/test/serve/basic/webpack.config.js +++ b/test/serve/basic/webpack.config.js @@ -3,5 +3,5 @@ const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); module.exports = { mode: 'development', devtool: false, - plugins: [new WebpackCLITestPlugin(['plugins'], false)], + plugins: [new WebpackCLITestPlugin(['mode', 'plugins'], false)], };