Skip to content

Commit

Permalink
tests: add more cases for target (#2207)
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Dec 8, 2020
1 parent e540d21 commit 99e2fbb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/target/flag-test/target-flag.test.js
Expand Up @@ -58,6 +58,22 @@ describe('--target flag', () => {
expect(stdout).toContain(`target: [ 'node', 'async-node' ]`);
});

it('should throw an error for invalid target in multiple syntax', () => {
const { exitCode, stderr, stdout } = run(__dirname, ['--target', 'node', '--target', 'invalid']);

expect(exitCode).toBe(2);
expect(stderr).toContain(`Error: Unknown target 'invalid'`);
expect(stdout).toBeFalsy();
});

it('should throw an error for incompatible multiple targets', () => {
const { exitCode, stderr, stdout } = run(__dirname, ['--target', 'node', '--target', 'web']);

expect(exitCode).toBe(2);
expect(stderr).toContain('Error: Universal Chunk Loading is not implemented yet');
expect(stdout).toBeFalsy();
});

it('should reset target from node to async-node with --target-reset', () => {
const { exitCode, stderr, stdout } = run(__dirname, ['--target-reset', '--target', 'async-node']);

Expand Down

0 comments on commit 99e2fbb

Please sign in to comment.