-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(@angular/cli): fully test update process in update from v8 E2E
This commit changes the update-8 E2E test to use the recommended update procedure of updating one major version at a time.
- Loading branch information
1 parent
4a4ac66
commit 583fc2a
Showing
1 changed file
with
18 additions
and
25 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,48 +1,41 @@ | ||
import { createProjectFromAsset } from '../../utils/assets'; | ||
import { getGlobalVariable } from '../../utils/env'; | ||
import { expectFileMatchToExist, rimraf, writeFile } from '../../utils/fs'; | ||
import { installWorkspacePackages, setRegistry } from '../../utils/packages'; | ||
import { expectFileMatchToExist } from '../../utils/fs'; | ||
import { installPackage, installWorkspacePackages, setRegistry } from '../../utils/packages'; | ||
import { ng, noSilentNg } from '../../utils/process'; | ||
import { isPrereleaseCli, useBuiltPackages, useCIChrome, useCIDefaults } from '../../utils/project'; | ||
import { isPrereleaseCli, useCIChrome, useCIDefaults } from '../../utils/project'; | ||
|
||
export default async function () { | ||
await createProjectFromAsset('8.0-project', true, true); | ||
const extraUpdateArgs = await isPrereleaseCli() || true ? ['--next', '--force'] : []; | ||
|
||
// We need to use the public registry because in the local NPM server we don't have | ||
// older versions @angular/cli packages which would cause `npm install` during `ng update` to fail. | ||
try { | ||
await setRegistry(false); | ||
await createProjectFromAsset('8.0-project', true, true); | ||
|
||
await useBuiltPackages(); | ||
await setRegistry(false); | ||
await installWorkspacePackages(); | ||
|
||
// Update Angular CLI. | ||
await ng('update', '@angular/cli', '--migrate-only', '--from=8'); | ||
// Update Angular to 9 | ||
await installPackage('@angular/cli@8'); | ||
await ng('update', '@angular/[email protected]', '@angular/[email protected]'); | ||
|
||
// Update Angular to 10 | ||
await ng('update', '@angular/cli@10', '@angular/core@10'); | ||
|
||
// Update Angular to 11 (force needed due to codelyzer) | ||
await ng('update', '@angular/cli@11', '@angular/core@11', '--force'); | ||
} finally { | ||
await setRegistry(true); | ||
} | ||
|
||
if (!getGlobalVariable('ci')) { | ||
const testRegistry = getGlobalVariable('package-registry'); | ||
await writeFile('.npmrc', `registry=${testRegistry}`); | ||
} | ||
|
||
// Update Angular. | ||
const extraUpdateArgs = await isPrereleaseCli() ? ['--next', '--force'] : []; | ||
await ng('update', '@angular/core', ...extraUpdateArgs); | ||
// Update Angular current build | ||
await ng('update', '@angular/cli', '@angular/core', ...extraUpdateArgs); | ||
|
||
// Use the packages we are building in this commit, and CI Chrome. | ||
await useBuiltPackages(); | ||
// Setup testing to use CI Chrome. | ||
await useCIChrome('./'); | ||
await useCIChrome('./e2e/'); | ||
await useCIDefaults('eight-project'); | ||
|
||
// This is needed as otherwise causes local modules not to override already present modules | ||
await rimraf('node_modules/@angular-devkit'); | ||
await rimraf('node_modules/@angular/cli'); | ||
|
||
await installWorkspacePackages(); | ||
|
||
// Run CLI commands. | ||
await ng('generate', 'component', 'my-comp'); | ||
await ng('test', '--watch=false'); | ||
|