Skip to content

Commit

Permalink
fix(@schematics/angular): fix migration for namedChunks and option
Browse files Browse the repository at this point in the history
Both values of  `extractLicenses` and `namedChunks` were inverted.

(cherry picked from commit decaef5)
  • Loading branch information
alan-agius4 committed Apr 28, 2021
1 parent 294642f commit 0ca35b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ type BuilderOptionsType = Readonly<[optionName: string, oldDefault: JsonValue |
const BrowserBuilderOptions: BuilderOptionsType = [
['aot', false, true],
['vendorChunk', true, false],
['extractLicenses', true, false],
['extractLicenses', false, true],
['buildOptimizer', false, true],
['sourceMap', true, false],
['optimization', false, true],
['namedChunks', false, true],
['namedChunks', true, false],
];

const ServerBuilderOptions: BuilderOptionsType = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function createWorkSpaceConfig(tree: UnitTestTree) {
optimization: true,
experimentalRollupPass: false,
buildOptimizer: false,
namedChunks: true,
// tslint:disable-next-line:no-any
} as any,
configurations: {
Expand Down Expand Up @@ -106,4 +107,12 @@ describe(`Migration to update 'angular.json'. ${schematicName}`, () => {
expect(configurations?.two.sourceMap).toBeUndefined();
expect(configurations?.two.optimization).toBeFalse();
});

it(`should not remove value in "options" when value is not the new default`, async () => {
const newTree = await schematicRunner.runSchematicAsync(schematicName, {}, tree).toPromise();
const { options } = getBuildTarget(newTree);

expect(options.namedChunks).toBeTrue();
expect(options.buildOptimizer).toBeFalse();
});
});

0 comments on commit 0ca35b1

Please sign in to comment.