Skip to content

Commit

Permalink
tests: core options for serve
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Dec 25, 2020
1 parent 6002c23 commit 05636b7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions test/serve/basic/serve-basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion test/serve/basic/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)],
};

0 comments on commit 05636b7

Please sign in to comment.