|
| 1 | +/** |
| 2 | + * @license |
| 3 | + * Copyright Google Inc. 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.io/license |
| 7 | + */ |
| 8 | +import { buildWebpackBrowser } from '../../index'; |
| 9 | +import { BASE_OPTIONS, BROWSER_BUILDER_INFO, describeBuilder } from '../setup'; |
| 10 | + |
| 11 | +describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => { |
| 12 | + describe('Option: "extractLicenses"', () => { |
| 13 | + it(`should generate '3rdpartylicenses.txt' when 'extractLicenses' is true`, async () => { |
| 14 | + harness.useTarget('build', { |
| 15 | + ...BASE_OPTIONS, |
| 16 | + extractLicenses: true, |
| 17 | + }); |
| 18 | + |
| 19 | + const { result } = await harness.executeOnce(); |
| 20 | + expect(result?.success).toBe(true); |
| 21 | + harness.expectFile('dist/3rdpartylicenses.txt').content.toContain('MIT'); |
| 22 | + }); |
| 23 | + |
| 24 | + it(`should not generate '3rdpartylicenses.txt' when 'extractLicenses' is false`, async () => { |
| 25 | + harness.useTarget('build', { |
| 26 | + ...BASE_OPTIONS, |
| 27 | + extractLicenses: false, |
| 28 | + }); |
| 29 | + |
| 30 | + const { result } = await harness.executeOnce(); |
| 31 | + expect(result?.success).toBe(true); |
| 32 | + harness.expectFile('dist/3rdpartylicenses.txt').toNotExist(); |
| 33 | + }); |
| 34 | + |
| 35 | + it(`should not generate '3rdpartylicenses.txt' when 'extractLicenses' is not set`, async () => { |
| 36 | + harness.useTarget('build', { |
| 37 | + ...BASE_OPTIONS, |
| 38 | + }); |
| 39 | + |
| 40 | + const { result } = await harness.executeOnce(); |
| 41 | + expect(result?.success).toBe(true); |
| 42 | + harness.expectFile('dist/3rdpartylicenses.txt').toNotExist(); |
| 43 | + }); |
| 44 | + }); |
| 45 | +}); |
0 commit comments