forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(@angular-devkit/build-angular): change
extractLicenses
unit te…
…st to use build harness This change adds a unit tests for the browser builder's extractLicenses option using the builder test harness.
- Loading branch information
1 parent
df897f0
commit a266f55
Showing
2 changed files
with
45 additions
and
30 deletions.
There are no files selected for viewing
30 changes: 0 additions & 30 deletions
30
packages/angular_devkit/build_angular/src/browser/specs/license-extraction_spec.ts
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
packages/angular_devkit/build_angular/src/browser/tests/options/extract-licenses_spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
import { buildWebpackBrowser } from '../../index'; | ||
import { BASE_OPTIONS, BROWSER_BUILDER_INFO, describeBuilder } from '../setup'; | ||
|
||
describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => { | ||
describe('Option: "extractLicenses"', () => { | ||
it(`should generate '3rdpartylicenses.txt' when 'extractLicenses' is true`, async () => { | ||
harness.useTarget('build', { | ||
...BASE_OPTIONS, | ||
extractLicenses: true, | ||
}); | ||
|
||
const { result } = await harness.executeOnce(); | ||
expect(result?.success).toBe(true); | ||
harness.expectFile('dist/3rdpartylicenses.txt').content.toContain('MIT'); | ||
}); | ||
|
||
it(`should not generate '3rdpartylicenses.txt' when 'extractLicenses' is false`, async () => { | ||
harness.useTarget('build', { | ||
...BASE_OPTIONS, | ||
extractLicenses: false, | ||
}); | ||
|
||
const { result } = await harness.executeOnce(); | ||
expect(result?.success).toBe(true); | ||
harness.expectFile('dist/3rdpartylicenses.txt').toNotExist(); | ||
}); | ||
|
||
it(`should not generate '3rdpartylicenses.txt' when 'extractLicenses' is not set`, async () => { | ||
harness.useTarget('build', { | ||
...BASE_OPTIONS, | ||
}); | ||
|
||
const { result } = await harness.executeOnce(); | ||
expect(result?.success).toBe(true); | ||
harness.expectFile('dist/3rdpartylicenses.txt').toNotExist(); | ||
}); | ||
}); | ||
}); |