Skip to content

Commit

Permalink
tests: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Jan 25, 2021
1 parent e2970e8 commit d2f4cf5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
11 changes: 0 additions & 11 deletions test/serve/basic/serve-basic.test.js
Expand Up @@ -7,9 +7,6 @@ const { runServe, isWebpack5, isDevServer4 } = require('../../utils/test-utils')

const testPath = path.resolve(__dirname);

const usageText = 'webpack serve|s [options]';
const descriptionText = 'Run the webpack dev server';

describe('basic serve usage', () => {
let port;

Expand Down Expand Up @@ -161,14 +158,6 @@ describe('basic serve usage', () => {
expect(stdout.match(/HotModuleReplacementPlugin/g)).toBeNull();
});

it('should log help information and respect the "--no-color" option', async () => {
const { stdout, stderr } = await runServe(__dirname, ['--help', '--no-color']);

expect(stderr).toBeFalsy();
expect(stdout).toContain(usageText);
expect(stdout).toContain(descriptionText);
});

it('should work with the "--client-log-level" option', async () => {
const { stdout, stderr } = await runServe(testPath, ['--client-log-level', 'info']);

Expand Down
17 changes: 14 additions & 3 deletions test/serve/help/serve-help.test.js
@@ -1,11 +1,12 @@
const { runServe, isWebpack5 } = require('../../utils/test-utils');

const usageText = 'webpack serve|s [options]';
const usageText = 'webpack serve|s [entries...] [options]';
const descriptionText = 'Run the webpack dev server';

describe('serve help', () => {
it('should output serve help', async () => {
it('should log help information', async () => {
const { stderr, stdout, exitCode } = await runServe(__dirname, ['--help']);

expect(stderr).toBeFalsy();
expect(exitCode).toBe(0);
expect(stdout).toContain(descriptionText);
Expand All @@ -18,15 +19,25 @@ describe('serve help', () => {
expect(stdout).toContain('--open [value]');
});

it('should output all flags when verbose help is set', async () => {
it('should log help information using "verbose"', async () => {
const { stderr, stdout, exitCode } = await runServe(__dirname, ['--help', 'verbose']);

expect(stderr).toBeFalsy();
expect(exitCode).toBe(0);
expect(stdout).toContain(descriptionText);
expect(stdout).toContain(usageText);
expect(stdout).toContain('Options:');

if (isWebpack5) {
expect(stdout).toContain('--cache-type');
}
});

it('should log help information and respect the "--no-color" option', async () => {
const { stdout, stderr } = await runServe(__dirname, ['--help', '--no-color']);

expect(stderr).toBeFalsy();
expect(stdout).toContain(usageText);
expect(stdout).toContain(descriptionText);
});
});

0 comments on commit d2f4cf5

Please sign in to comment.