mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
test: remove usages of deprecated runSchematicAsync function (#48745)
Removes our usages of `runSchematicAsync` since it is deprecated. PR Close #48745
This commit is contained in:
parent
5e5e7d79d0
commit
1e30baaaa7
4 changed files with 11 additions and 12 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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(() => {
|
||||
|
|
|
|||
|
|
@ -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(() => {
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
|
|
|||
Loading…
Reference in a new issue