Skip to content

Commit

Permalink
test(@angular/cli): disable ng update tests that are no longer supp…
Browse files Browse the repository at this point in the history
…orted

Multiple versions update is no longer supported.
  • Loading branch information
alan-agius4 committed Nov 24, 2021
1 parent 460ea21 commit 021d281
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
11 changes: 5 additions & 6 deletions packages/angular/cli/commands/update-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,15 +507,14 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
}
}

let result: boolean;
if (typeof options.migrateOnly == 'string') {
await this.executeMigration(
result = await this.executeMigration(
packageName,
migrations,
options.migrateOnly,
options.createCommits,
);

return 0;
} else {
const from = coerceVersionNumber(options.from);
if (!from) {
Expand All @@ -528,15 +527,15 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
'>' + from + ' <=' + (options.to || packageNode.package.version),
);

await this.executeMigrations(
result = await this.executeMigrations(
packageName,
migrations,
migrationRange,
options.createCommits,
);

return 0;
}

return result ? 0 : 1;
}

const requests: {
Expand Down
2 changes: 2 additions & 0 deletions tests/legacy-cli/e2e/tests/update/update-1.0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { isPrereleaseCli, useBuiltPackages, useCIChrome, useCIDefaults } from '.
import { expectToFail } from '../../utils/utils';

export default async function() {
return;

const extraUpdateArgs = (await isPrereleaseCli()) ? ['--next', '--force'] : [];

await createProjectFromAsset('1.0-project');
Expand Down
6 changes: 4 additions & 2 deletions tests/legacy-cli/e2e/tests/update/update-1.7-longhand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { isPrereleaseCli, useBuiltPackages } from '../../utils/project';
import { expectToFail } from '../../utils/utils';

export default async function() {
return;

const extraUpdateArgs = (await isPrereleaseCli()) ? ['--next', '--force'] : [];

await createProjectFromAsset('1.7-project');
await createProjectFromAsset('1.7-project', true);

await expectToFail(() => ng('build'));
await ng('update', '@angular/cli', '--migrate-only', '--from=1.7.1');
await ng('update', '@angular/cli@8', '--migrate-only', '--from=1.7.1');
await useBuiltPackages();
await silentNpm('install');
await ng('update', '@angular/core@10', ...extraUpdateArgs);
Expand Down
1 change: 1 addition & 0 deletions tests/legacy-cli/e2e/tests/update/update-1.7.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { isPrereleaseCli, useBuiltPackages, useCIChrome, useCIDefaults } from '.
import { expectToFail } from '../../utils/utils';

export default async function() {
return;
const extraUpdateArgs = (await isPrereleaseCli()) ? ['--next', '--force'] : [];

await createProjectFromAsset('1.7-project');
Expand Down
19 changes: 13 additions & 6 deletions tests/legacy-cli/e2e/tests/update/update-7.0.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import { createProjectFromAsset } from '../../utils/assets';
import { expectFileMatchToExist, expectFileToExist, expectFileToMatch } from '../../utils/fs';
import {
expectFileMatchToExist,
expectFileToExist,
expectFileToMatch,
writeFile,
} from '../../utils/fs';
import { ng, noSilentNg, silentNpm } from '../../utils/process';
import { isPrereleaseCli, useBuiltPackages, useCIChrome, useCIDefaults } from '../../utils/project';
import { expectToFail } from '../../utils/utils';

export default async function() {
await createProjectFromAsset('7.0-project');
await ng('update', '@angular/cli', '--migrate-only', '--from=7');
export default async function () {
await createProjectFromAsset('7.0-project', true);
// Update Angular.
await ng('update', '@angular/core@8', '@angular/cli@8', '--force');
await ng('update', '@angular/core@9', '@angular/cli@9', '--force');

// Test CLI migrations.
// Should update the lazy route syntax via update-lazy-module-paths.
Expand All @@ -27,11 +34,11 @@ export default async function() {
await useCIChrome('src/');
await useCIChrome('e2e/');
await useCIDefaults('seven-oh-project');
await writeFile('.npmrc', 'registry = http://localhost:4873', 'utf8');
await silentNpm('install');

// Update Angular.
const extraUpdateArgs = (await isPrereleaseCli()) ? ['--next', '--force'] : [];
await ng('update', '@angular/core@10', ...extraUpdateArgs);
await ng('update', '@angular/core@10', '@angular/cli@10', ...extraUpdateArgs);

// Run CLI commands.
await ng('generate', 'component', 'my-comp');
Expand Down

0 comments on commit 021d281

Please sign in to comment.