Skip to content

Commit

Permalink
tests: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Nov 30, 2020
1 parent a322e0f commit b21e07a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 8 additions & 4 deletions packages/webpack-cli/__tests__/serve/serve.test.js
Expand Up @@ -12,16 +12,20 @@ describe('Serve', () => {
}

it('should run with cli', async () => {
const { stdout, stderr } = await runServe([], __dirname);
const { stderr, stdout } = await runServe([], __dirname);

expect(stderr).toContain('Compilation starting...');
expect(stderr).toContain('Compilation finished');
expect(stdout).toContain('main.js');
expect(stdout).not.toContain('HotModuleReplacementPlugin');
expect(stderr).toHaveLength(0);
});

it('should work with flags', async () => {
const { stdout, stderr } = await runServe(['--hot'], __dirname);
const { stderr, stdout } = await runServe(['--hot'], __dirname);

expect(stderr).toContain('Compilation starting...');
expect(stderr).toContain('Compilation finished');
expect(stdout).toContain('main.js');
expect(stdout).toContain('HotModuleReplacementPlugin');
expect(stderr).toHaveLength(0);
});
});
9 changes: 7 additions & 2 deletions test/bail/bail.test.js
Expand Up @@ -69,14 +69,19 @@ describe('bail and watch warning', () => {
});

it('should log warning in case of multiple compilers', async () => {
const { stderr, stdout } = await runWatch(__dirname, ['-c', 'multi-webpack.config.js'], true, "Compilation 'second' finished");
const { stderr, stdout } = await runWatch(
__dirname,
['-c', 'multi-webpack.config.js'],
true,
"Compiler 'second' is watching files for updates...",
);

expect(stderr).toContain("Compilation 'first' starting...");
expect(stderr).toContain("Compilation 'first' finished");
expect(stderr).toContain("Compiler 'first' is watching files for updates...");
expect(stderr).toContain("Compilation 'second' starting...");
expect(stderr).toContain("Compilation 'second' finished");
expect(stderr).not.toContain("Compiler 'second' is watching files for updates...");
expect(stderr).toContain("Compiler 'second' is watching files for updates...");
expect(stderr).toContain(`You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.`);
expect(stdout).toBeTruthy();
});
Expand Down

0 comments on commit b21e07a

Please sign in to comment.