From 99e2fbb3b36666cb37a94f6032960fd29d28e056 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Tue, 8 Dec 2020 16:41:56 +0530 Subject: [PATCH] tests: add more cases for target (#2207) --- test/target/flag-test/target-flag.test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/target/flag-test/target-flag.test.js b/test/target/flag-test/target-flag.test.js index 9a3d69bbccb..b761b9c7cc8 100644 --- a/test/target/flag-test/target-flag.test.js +++ b/test/target/flag-test/target-flag.test.js @@ -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']);