Skip to content

Commit

Permalink
fix(@angular/cli): ensure update migrations are fully executed
Browse files Browse the repository at this point in the history
With the move to refactor and centralize the update logic, the schematics wrapper context needs to be updated to create an exception for the new location of the update schematic.
  • Loading branch information
clydin authored and alan-agius4 committed Apr 2, 2021
1 parent f6e1fd8 commit e84fa72
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/angular/cli/models/schematic-engine-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ function shouldWrapSchematic(schematicFile: string): boolean {
}
}

// Never wrap `@schematics/update` when executed directly
// Never wrap the internal update schematic when executed directly
// It communicates with the update command via `global`
if (/[\/\\]node_modules[\/\\]@schematics[\/\\]update[\/\\]/.test(schematicFile)) {
if (/[\/\\]node_modules[\/\\]@angular[\/\\]cli[\/\\]/.test(schematicFile)) {
return false;
}

Expand Down
5 changes: 4 additions & 1 deletion tests/legacy-cli/e2e/tests/update/update-8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export default async function () {

// Update Angular to 9
await installPackage('@angular/cli@8');
await ng('update', '@angular/[email protected]', '@angular/[email protected]');
const { stdout } = await ng('update', '@angular/[email protected]', '@angular/[email protected]');
if (!stdout.includes('Executing migrations of package \'@angular/cli\'')) {
throw new Error('Update did not execute migrations. OUTPUT: \n' + stdout);
}

// Update Angular to 10
await ng('update', '@angular/cli@10', '@angular/core@10');
Expand Down

0 comments on commit e84fa72

Please sign in to comment.