|
6 | 6 | * found in the LICENSE file at https://angular.io/license
|
7 | 7 | */
|
8 | 8 |
|
9 |
| -import {SchematicTestRunner, UnitTestTree} from '@angular-devkit/schematics/testing'; |
10 |
| -import {switchMap} from 'rxjs/operators'; |
| 9 | +import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'; |
11 | 10 |
|
12 | 11 | /** Path to the collection file for the NgUniversal schematics */
|
13 | 12 | export const collectionPath = require.resolve('@schematics/angular/collection.json');
|
14 | 13 |
|
15 | 14 | /** Create a base app used for testing. */
|
16 |
| -export function createTestApp(appOptions = {}): Promise<UnitTestTree> { |
| 15 | +export async function createTestApp(appOptions = {}): Promise<UnitTestTree> { |
17 | 16 | const baseRunner =
|
18 |
| - new SchematicTestRunner('universal-schematics', collectionPath); |
| 17 | + new SchematicTestRunner('universal-schematics', collectionPath); |
19 | 18 |
|
20 |
| - return baseRunner |
21 |
| - .runExternalSchematicAsync('@schematics/angular', 'workspace', { |
22 |
| - name: 'workspace', |
23 |
| - version: '6.0.0', |
24 |
| - newProjectRoot: 'projects', |
25 |
| - }) |
26 |
| - .pipe( |
27 |
| - switchMap(workspaceTree => baseRunner.runExternalSchematicAsync( |
28 |
| - '@schematics/angular', 'application', |
29 |
| - {...appOptions, name: 'test-app'}, workspaceTree)), |
30 |
| - ) |
31 |
| - .toPromise(); |
| 19 | + const tree = await baseRunner.runExternalSchematicAsync('@schematics/angular', 'workspace', { |
| 20 | + name: 'workspace', |
| 21 | + version: '6.0.0', |
| 22 | + newProjectRoot: 'projects', |
| 23 | + }).toPromise(); |
| 24 | + |
| 25 | + return baseRunner.runExternalSchematicAsync( |
| 26 | + '@schematics/angular', 'application', |
| 27 | + { |
| 28 | + ...appOptions, |
| 29 | + name: 'test-app', |
| 30 | + }, |
| 31 | + tree |
| 32 | + ).toPromise(); |
32 | 33 | }
|
0 commit comments