From 1e30baaaa75123200ca7b5093e596b640a42d5ed Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Mon, 16 Jan 2023 10:53:29 +0100 Subject: [PATCH] test: remove usages of deprecated runSchematicAsync function (#48745) Removes our usages of `runSchematicAsync` since it is deprecated. PR Close #48745 --- .../core/schematics/test/all-migrations.spec.ts | 2 +- .../test/relative_link_resolution_spec.ts | 2 +- .../test/router_link_with_href_spec.ts | 2 +- .../localize/schematics/ng-add/index_spec.ts | 17 ++++++++--------- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/core/schematics/test/all-migrations.spec.ts b/packages/core/schematics/test/all-migrations.spec.ts index eb369bb522d..ebcb0ea8e36 100644 --- a/packages/core/schematics/test/all-migrations.spec.ts +++ b/packages/core/schematics/test/all-migrations.spec.ts @@ -56,7 +56,7 @@ describe('all migrations', () => { } async function runMigration(migrationName: string) { - await runner.runSchematicAsync(migrationName, undefined, tree).toPromise(); + await runner.runSchematic(migrationName, undefined, tree); } if (!allMigrationSchematics.length) { diff --git a/packages/core/schematics/test/relative_link_resolution_spec.ts b/packages/core/schematics/test/relative_link_resolution_spec.ts index e936fe32b38..d85083dbc54 100644 --- a/packages/core/schematics/test/relative_link_resolution_spec.ts +++ b/packages/core/schematics/test/relative_link_resolution_spec.ts @@ -25,7 +25,7 @@ describe('Relative link resolution config migration', () => { } function runMigration() { - return runner.runSchematicAsync('migration-v15-relative-link-resolution', {}, tree).toPromise(); + return runner.runSchematic('migration-v15-relative-link-resolution', {}, tree); } beforeEach(() => { diff --git a/packages/core/schematics/test/router_link_with_href_spec.ts b/packages/core/schematics/test/router_link_with_href_spec.ts index 32ded205079..2ea789b1c5c 100644 --- a/packages/core/schematics/test/router_link_with_href_spec.ts +++ b/packages/core/schematics/test/router_link_with_href_spec.ts @@ -25,7 +25,7 @@ describe('RouterLinkWithHref migration', () => { } function runMigration() { - return runner.runSchematicAsync('migration-v15-router-link-with-href', {}, tree).toPromise(); + return runner.runSchematic('migration-v15-router-link-with-href', {}, tree); } beforeEach(() => { diff --git a/packages/localize/schematics/ng-add/index_spec.ts b/packages/localize/schematics/ng-add/index_spec.ts index de1567ee2c5..7af82e99037 100644 --- a/packages/localize/schematics/ng-add/index_spec.ts +++ b/packages/localize/schematics/ng-add/index_spec.ts @@ -77,7 +77,7 @@ describe('ng-add schematic', () => { }); it(`should add '@angular/localize' type reference in 'main.ts'`, async () => { - host = await schematicRunner.runSchematicAsync('ng-add', defaultOptions, host).toPromise(); + host = await schematicRunner.runSchematic('ng-add', defaultOptions, host); expect(host.readText('main.ts')).toContain(localizeTripleSlashType); }); @@ -88,7 +88,7 @@ describe('ng-add schematic', () => { import { enableProdMode } from '@angular/core'; `; host.overwrite('main.ts', mainContentInput); - host = await schematicRunner.runSchematicAsync('ng-add', defaultOptions, host).toPromise(); + host = await schematicRunner.runSchematic('ng-add', defaultOptions, host); expect(host.readText('main.ts')).toBe(mainContentInput); }); @@ -102,7 +102,7 @@ describe('ng-add schematic', () => { host.create('tsconfig.unknown.json', tsConfig); - host = await schematicRunner.runSchematicAsync('ng-add', defaultOptions, host).toPromise(); + host = await schematicRunner.runSchematic('ng-add', defaultOptions, host); const {compilerOptions} = host.readJson('tsconfig.unknown.json') as TsConfig; const types = compilerOptions?.types; expect(types).not.toContain('@angular/localize'); @@ -119,7 +119,7 @@ describe('ng-add schematic', () => { host.create('tsconfig.app.json', tsConfig); - host = await schematicRunner.runSchematicAsync('ng-add', defaultOptions, host).toPromise(); + host = await schematicRunner.runSchematic('ng-add', defaultOptions, host); const {compilerOptions} = host.readJson('tsconfig.app.json') as TsConfig; const types = compilerOptions?.types; expect(types).toContain('@angular/localize'); @@ -137,7 +137,7 @@ describe('ng-add schematic', () => { host.create('tsconfig.spec.json', tsConfig); - host = await schematicRunner.runSchematicAsync('ng-add', defaultOptions, host).toPromise(); + host = await schematicRunner.runSchematic('ng-add', defaultOptions, host); const {compilerOptions} = host.readJson('tsconfig.spec.json') as TsConfig; const types = compilerOptions?.types; expect(types).toContain('@angular/localize'); @@ -152,7 +152,7 @@ describe('ng-add schematic', () => { host.create('tsconfig.server.json', tsConfig); - host = await schematicRunner.runSchematicAsync('ng-add', defaultOptions, host).toPromise(); + host = await schematicRunner.runSchematic('ng-add', defaultOptions, host); const {compilerOptions} = host.readJson('tsconfig.server.json') as TsConfig; const types = compilerOptions?.types; expect(types).toContain('@angular/localize'); @@ -160,9 +160,8 @@ describe('ng-add schematic', () => { }); it('should add package to `dependencies` if `useAtRuntime` is `true`', async () => { - host = await schematicRunner - .runSchematicAsync('ng-add', {...defaultOptions, useAtRuntime: true}, host) - .toPromise(); + host = + await schematicRunner.runSchematic('ng-add', {...defaultOptions, useAtRuntime: true}, host); const {devDependencies, dependencies} = host.readJson('/package.json') as { devDependencies: {[key: string]: string};