|
| 1 | +/** |
| 2 | + * @license |
| 3 | + * Copyright Google LLC All Rights Reserved. |
| 4 | + * |
| 5 | + * Use of this source code is governed by an MIT-style license that can be |
| 6 | + * found in the LICENSE file at https://angular.dev/license |
| 7 | + */ |
| 8 | + |
| 9 | +import { execute } from '../../index'; |
| 10 | +import { |
| 11 | + BASE_OPTIONS, |
| 12 | + describeBuilder, |
| 13 | + UNIT_TEST_BUILDER_INFO, |
| 14 | + setupApplicationTarget, |
| 15 | + expectLog, |
| 16 | +} from '../setup'; |
| 17 | + |
| 18 | +describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { |
| 19 | + describe('Option: "isolate"', () => { |
| 20 | + beforeEach(async () => { |
| 21 | + setupApplicationTarget(harness); |
| 22 | + }); |
| 23 | + |
| 24 | + it('should fail when isolate is true and runner is karma', async () => { |
| 25 | + harness.useTarget('test', { |
| 26 | + ...BASE_OPTIONS, |
| 27 | + runner: 'karma' as any, |
| 28 | + isolate: true, |
| 29 | + }); |
| 30 | + |
| 31 | + const { result, logs } = await harness.executeOnce(); |
| 32 | + expect(result?.success).toBeFalse(); |
| 33 | + expectLog(logs, /The "isolate" option is only available for the "vitest" runner/); |
| 34 | + }); |
| 35 | + |
| 36 | + it('should run tests successfully when isolate is true and runner is vitest', async () => { |
| 37 | + harness.useTarget('test', { |
| 38 | + ...BASE_OPTIONS, |
| 39 | + runner: 'vitest' as any, |
| 40 | + isolate: true, |
| 41 | + }); |
| 42 | + |
| 43 | + const { result } = await harness.executeOnce(); |
| 44 | + expect(result?.success).toBeTrue(); |
| 45 | + }); |
| 46 | + |
| 47 | + it('should run tests successfully when isolate is false and runner is vitest', async () => { |
| 48 | + harness.useTarget('test', { |
| 49 | + ...BASE_OPTIONS, |
| 50 | + runner: 'vitest' as any, |
| 51 | + isolate: false, |
| 52 | + }); |
| 53 | + |
| 54 | + const { result } = await harness.executeOnce(); |
| 55 | + expect(result?.success).toBeTrue(); |
| 56 | + }); |
| 57 | + }); |
| 58 | +}); |
0 commit comments