Skip to content

Commit 583fc2a

Browse files
clydinalan-agius4
authored andcommitted
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.
1 parent 4a4ac66 commit 583fc2a

File tree

1 file changed

+18
-25
lines changed

1 file changed

+18
-25
lines changed

tests/legacy-cli/e2e/tests/update/update-8.ts

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,41 @@
11
import { createProjectFromAsset } from '../../utils/assets';
2-
import { getGlobalVariable } from '../../utils/env';
3-
import { expectFileMatchToExist, rimraf, writeFile } from '../../utils/fs';
4-
import { installWorkspacePackages, setRegistry } from '../../utils/packages';
2+
import { expectFileMatchToExist } from '../../utils/fs';
3+
import { installPackage, installWorkspacePackages, setRegistry } from '../../utils/packages';
54
import { ng, noSilentNg } from '../../utils/process';
6-
import { isPrereleaseCli, useBuiltPackages, useCIChrome, useCIDefaults } from '../../utils/project';
5+
import { isPrereleaseCli, useCIChrome, useCIDefaults } from '../../utils/project';
76

87
export default async function () {
9-
await createProjectFromAsset('8.0-project', true, true);
8+
const extraUpdateArgs = await isPrereleaseCli() || true ? ['--next', '--force'] : [];
109

1110
// We need to use the public registry because in the local NPM server we don't have
1211
// older versions @angular/cli packages which would cause `npm install` during `ng update` to fail.
1312
try {
14-
await setRegistry(false);
13+
await createProjectFromAsset('8.0-project', true, true);
1514

16-
await useBuiltPackages();
15+
await setRegistry(false);
1716
await installWorkspacePackages();
1817

19-
// Update Angular CLI.
20-
await ng('update', '@angular/cli', '--migrate-only', '--from=8');
18+
// Update Angular to 9
19+
await installPackage('@angular/cli@8');
20+
await ng('update', '@angular/[email protected]', '@angular/[email protected]');
21+
22+
// Update Angular to 10
23+
await ng('update', '@angular/cli@10', '@angular/core@10');
24+
25+
// Update Angular to 11 (force needed due to codelyzer)
26+
await ng('update', '@angular/cli@11', '@angular/core@11', '--force');
2127
} finally {
2228
await setRegistry(true);
2329
}
2430

25-
if (!getGlobalVariable('ci')) {
26-
const testRegistry = getGlobalVariable('package-registry');
27-
await writeFile('.npmrc', `registry=${testRegistry}`);
28-
}
29-
30-
// Update Angular.
31-
const extraUpdateArgs = await isPrereleaseCli() ? ['--next', '--force'] : [];
32-
await ng('update', '@angular/core', ...extraUpdateArgs);
31+
// Update Angular current build
32+
await ng('update', '@angular/cli', '@angular/core', ...extraUpdateArgs);
3333

34-
// Use the packages we are building in this commit, and CI Chrome.
35-
await useBuiltPackages();
34+
// Setup testing to use CI Chrome.
3635
await useCIChrome('./');
3736
await useCIChrome('./e2e/');
3837
await useCIDefaults('eight-project');
3938

40-
// This is needed as otherwise causes local modules not to override already present modules
41-
await rimraf('node_modules/@angular-devkit');
42-
await rimraf('node_modules/@angular/cli');
43-
44-
await installWorkspacePackages();
45-
4639
// Run CLI commands.
4740
await ng('generate', 'component', 'my-comp');
4841
await ng('test', '--watch=false');

0 commit comments

Comments
 (0)