Skip to content

Commit 5a7b823

Browse files
clydinKeen Yee Liau
authored andcommitted
test: remove use of deprecated synchronous test helper runSchematic
1 parent d54b767 commit 5a7b823

File tree

25 files changed

+243
-243
lines changed

25 files changed

+243
-243
lines changed

packages/angular/pwa/pwa/index_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('PWA Schematic', () => {
4141
};
4242

4343
beforeEach(async () => {
44-
appTree = schematicRunner.runExternalSchematic('@schematics/angular', 'workspace', workspaceOptions);
44+
appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise();
4545
appTree = await schematicRunner.runExternalSchematicAsync(
4646
'@schematics/angular',
4747
'application',

packages/schematics/angular/app-shell/index_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ describe('App Shell Schematic', () => {
3939
let appTree: UnitTestTree;
4040

4141
beforeEach(async () => {
42-
appTree = schematicRunner.runSchematic('workspace', workspaceOptions);
42+
appTree = await schematicRunner.runSchematicAsync('workspace', workspaceOptions).toPromise();
4343
appTree = await schematicRunner.runSchematicAsync('application', appOptions, appTree)
4444
.toPromise();
4545
});
4646

4747
it('should ensure the client app has a router-outlet', async () => {
48-
appTree = schematicRunner.runSchematic('workspace', workspaceOptions);
48+
appTree = await schematicRunner.runSchematicAsync('workspace', workspaceOptions).toPromise();
4949
appTree = await schematicRunner.runSchematicAsync(
5050
'application',
5151
{...appOptions, routing: false},

packages/schematics/angular/application/index_spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ describe('Application Schematic', () => {
3333
};
3434

3535
let workspaceTree: UnitTestTree;
36-
beforeEach(() => {
37-
workspaceTree = schematicRunner.runSchematic('workspace', workspaceOptions);
36+
beforeEach(async () => {
37+
workspaceTree = await schematicRunner.runSchematicAsync('workspace', workspaceOptions).toPromise();
3838
});
3939

4040
it('should create all files of an application', async () => {
@@ -408,7 +408,7 @@ describe('Application Schematic', () => {
408408
});
409409

410410
it(`should create correct paths when 'newProjectRoot' is blank`, async () => {
411-
const workspaceTree = schematicRunner.runSchematic('workspace', { ...workspaceOptions, newProjectRoot: '' });
411+
const workspaceTree = await schematicRunner.runSchematicAsync('workspace', { ...workspaceOptions, newProjectRoot: '' }).toPromise();
412412
const options = { ...defaultOptions, projectRoot: undefined };
413413
const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree)
414414
.toPromise();

packages/schematics/angular/class/index_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('Class Schematic', () => {
4040
};
4141
let appTree: UnitTestTree;
4242
beforeEach(async () => {
43-
appTree = schematicRunner.runSchematic('workspace', workspaceOptions);
43+
appTree = await schematicRunner.runSchematicAsync('workspace', workspaceOptions).toPromise();
4444
appTree = await schematicRunner.runSchematicAsync('application', appOptions, appTree)
4545
.toPromise();
4646
});

packages/schematics/angular/component/index_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('Component Schematic', () => {
4747
};
4848
let appTree: UnitTestTree;
4949
beforeEach(async () => {
50-
appTree = schematicRunner.runSchematic('workspace', workspaceOptions);
50+
appTree = await schematicRunner.runSchematicAsync('workspace', workspaceOptions).toPromise();
5151
appTree = await schematicRunner
5252
.runSchematicAsync('application', appOptions, appTree)
5353
.toPromise();
@@ -167,7 +167,7 @@ describe('Component Schematic', () => {
167167
const options = { ...defaultOptions, module: '/projects/bar/src/app.moduleXXX.ts' };
168168
let thrownError: Error | null = null;
169169
try {
170-
schematicRunner.runSchematic('component', options, appTree);
170+
await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
171171
} catch (err) {
172172
thrownError = err;
173173
}

packages/schematics/angular/directive/index_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('Directive Schematic', () => {
4040
};
4141
let appTree: UnitTestTree;
4242
beforeEach(async () => {
43-
appTree = schematicRunner.runSchematic('workspace', workspaceOptions);
43+
appTree = await schematicRunner.runSchematicAsync('workspace', workspaceOptions).toPromise();
4444
appTree = await schematicRunner.runSchematicAsync('application', appOptions, appTree)
4545
.toPromise();
4646
});

packages/schematics/angular/e2e/index_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('Application Schematic', () => {
3838
let applicationTree: UnitTestTree;
3939

4040
beforeEach(async () => {
41-
const workspaceTree = schematicRunner.runSchematic('workspace', workspaceOptions);
41+
const workspaceTree = await schematicRunner.runSchematicAsync('workspace', workspaceOptions).toPromise();
4242
applicationTree = await schematicRunner.runSchematicAsync(
4343
'application',
4444
defaultAppOptions,

packages/schematics/angular/enum/index_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('Enum Schematic', () => {
3737
};
3838
let appTree: UnitTestTree;
3939
beforeEach(async () => {
40-
appTree = schematicRunner.runSchematic('workspace', workspaceOptions);
40+
appTree = await schematicRunner.runSchematicAsync('workspace', workspaceOptions).toPromise();
4141
appTree = await schematicRunner.runSchematicAsync('application', appOptions, appTree)
4242
.toPromise();
4343
});

packages/schematics/angular/guard/index_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('Guard Schematic', () => {
3636
};
3737
let appTree: UnitTestTree;
3838
beforeEach(async () => {
39-
appTree = schematicRunner.runSchematic('workspace', workspaceOptions);
39+
appTree = await schematicRunner.runSchematicAsync('workspace', workspaceOptions).toPromise();
4040
appTree = await schematicRunner.runSchematicAsync('application', appOptions, appTree)
4141
.toPromise();
4242
});

packages/schematics/angular/interface/index_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('Interface Schematic', () => {
3939
};
4040
let appTree: UnitTestTree;
4141
beforeEach(async () => {
42-
appTree = schematicRunner.runSchematic('workspace', workspaceOptions);
42+
appTree = await schematicRunner.runSchematicAsync('workspace', workspaceOptions).toPromise();
4343
appTree = await schematicRunner.runSchematicAsync('application', appOptions, appTree)
4444
.toPromise();
4545
});

packages/schematics/angular/library/index_spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ describe('Library Schematic', () => {
3636
};
3737

3838
let workspaceTree: UnitTestTree;
39-
beforeEach(() => {
40-
workspaceTree = schematicRunner.runSchematic('workspace', workspaceOptions);
39+
beforeEach(async () => {
40+
workspaceTree = await schematicRunner.runSchematicAsync('workspace', workspaceOptions).toPromise();
4141
});
4242

4343
it('should create files', async () => {
@@ -302,7 +302,7 @@ describe('Library Schematic', () => {
302302
});
303303

304304
it(`should create correct paths when 'newProjectRoot' is blank`, async () => {
305-
const workspaceTree = schematicRunner.runSchematic('workspace', { ...workspaceOptions, newProjectRoot: '' });
305+
const workspaceTree = await schematicRunner.runSchematicAsync('workspace', { ...workspaceOptions, newProjectRoot: '' }).toPromise();
306306
const tree = await schematicRunner.runSchematicAsync('library', defaultOptions, workspaceTree)
307307
.toPromise();
308308
const config = JSON.parse(tree.readContent('/angular.json'));

0 commit comments

Comments
 (0)