@@ -33,9 +33,7 @@ describe('Schematic Tests Nest Add', () => {
33
33
rootModuleClassName : 'AppModule'
34
34
} ;
35
35
36
- const tree = await runner
37
- . runSchematicAsync ( 'nest-add' , options , nestTree )
38
- . toPromise ( ) ;
36
+ const tree = await runner . runSchematic ( 'nest-add' , options , nestTree ) ;
39
37
const files : string [ ] = tree . files ;
40
38
expect ( files ) . toEqual ( [
41
39
'/.eslintrc.js' ,
@@ -72,10 +70,7 @@ describe('Schematic Tests Nest Add', () => {
72
70
rootModuleClassName : 'AppModule'
73
71
} ;
74
72
75
- const tree = await runner
76
- . runSchematicAsync ( 'nest-add' , options , nestTree )
77
- . toPromise ( ) ;
78
-
73
+ const tree = await runner . runSchematic ( 'nest-add' , options , nestTree ) ;
79
74
const fileContent = getFileContent ( tree , '/nest-cli.json' ) ;
80
75
expect ( fileContent ) . toContain ( `"sourceRoot": "src"` ) ;
81
76
} ) ;
@@ -89,10 +84,7 @@ describe('Schematic Tests Nest Add', () => {
89
84
rootModuleClassName : 'AppModule'
90
85
} ;
91
86
92
- const tree = await runner
93
- . runSchematicAsync ( 'nest-add' , options , nestTree )
94
- . toPromise ( ) ;
95
-
87
+ const tree = await runner . runSchematic ( 'nest-add' , options , nestTree ) ;
96
88
const fileContent = getFileContent ( tree , '/src/main.azure.ts' ) ;
97
89
98
90
expect ( fileContent ) . toContain (
@@ -109,10 +101,7 @@ describe('Schematic Tests Nest Add', () => {
109
101
rootModuleClassName : 'AppModule'
110
102
} ;
111
103
112
- const tree = await runner
113
- . runSchematicAsync ( 'nest-add' , options , nestTree )
114
- . toPromise ( ) ;
115
-
104
+ const tree = await runner . runSchematic ( 'nest-add' , options , nestTree ) ;
116
105
const fileContent = getFileContent ( tree , '/main/index.ts' ) ;
117
106
118
107
expect ( fileContent ) . toContain (
@@ -129,10 +118,7 @@ describe('Schematic Tests Nest Add', () => {
129
118
rootModuleClassName : 'AppModule'
130
119
} ;
131
120
132
- const tree = await runner
133
- . runSchematicAsync ( 'nest-add' , options , nestTree )
134
- . toPromise ( ) ;
135
-
121
+ const tree = await runner . runSchematic ( 'nest-add' , options , nestTree ) ;
136
122
const fileContent = tree . get ( 'webpack.config.js' ) ;
137
123
138
124
expect ( fileContent ) . toBeNull ( ) ;
@@ -149,21 +135,16 @@ describe('Schematic Tests Nest Add', () => {
149
135
sourceRoot : `apps/${ projectName } /src`
150
136
} ;
151
137
152
- await runner
153
- . runExternalSchematicAsync (
154
- '@nestjs/schematics' ,
155
- 'sub-app' ,
156
- {
157
- name : projectName
158
- } ,
159
- nestTree
160
- )
161
- . toPromise ( ) ;
162
-
163
- const tree = await runner
164
- . runSchematicAsync ( 'nest-add' , options , nestTree )
165
- . toPromise ( ) ;
138
+ await runner . runExternalSchematic (
139
+ '@nestjs/schematics' ,
140
+ 'sub-app' ,
141
+ {
142
+ name : projectName
143
+ } ,
144
+ nestTree
145
+ ) ;
166
146
147
+ const tree = await runner . runSchematic ( 'nest-add' , options , nestTree ) ;
167
148
const files : string [ ] = tree . files ;
168
149
expect ( files ) . toEqual ( [
169
150
'/.eslintrc.js' ,
@@ -192,8 +173,8 @@ describe('Schematic Tests Nest Add', () => {
192
173
`/apps/${ projectName } /src/${ projectName } .module.ts` ,
193
174
`/apps/${ projectName } /src/${ projectName } .service.ts` ,
194
175
`/apps/${ projectName } /src/main.azure.ts` ,
195
- `/apps/${ projectName } /test/app.e2e-spec.ts` ,
196
176
`/apps/${ projectName } /test/jest-e2e.json` ,
177
+ `/apps/${ projectName } /test/app.e2e-spec.ts` ,
197
178
`/${ projectName } /function.json` ,
198
179
`/${ projectName } /index.ts` ,
199
180
`/${ projectName } /sample.dat` ,
@@ -209,20 +190,16 @@ describe('Schematic Tests Nest Add', () => {
209
190
sourceRoot : `apps/${ projectName } /src`
210
191
} ;
211
192
212
- await runner
213
- . runExternalSchematicAsync (
214
- '@nestjs/schematics' ,
215
- 'sub-app' ,
216
- {
217
- name : projectName
218
- } ,
219
- nestTree
220
- )
221
- . toPromise ( ) ;
222
-
223
- const tree = await runner
224
- . runSchematicAsync ( 'nest-add' , options , nestTree )
225
- . toPromise ( ) ;
193
+ await runner . runExternalSchematic (
194
+ '@nestjs/schematics' ,
195
+ 'sub-app' ,
196
+ {
197
+ name : projectName
198
+ } ,
199
+ nestTree
200
+ ) ;
201
+
202
+ const tree = await runner . runSchematic ( 'nest-add' , options , nestTree ) ;
226
203
const fileContent = getFileContent ( tree , '/nest-cli.json' ) ;
227
204
const parsedFile = JSON . parse ( fileContent ) ;
228
205
expect ( parsedFile . projects [ projectName ] . sourceRoot ) . toEqual (
@@ -238,20 +215,16 @@ describe('Schematic Tests Nest Add', () => {
238
215
sourceRoot : `apps/${ projectName } /src`
239
216
} ;
240
217
241
- await runner
242
- . runExternalSchematicAsync (
243
- '@nestjs/schematics' ,
244
- 'sub-app' ,
245
- {
246
- name : projectName
247
- } ,
248
- nestTree
249
- )
250
- . toPromise ( ) ;
251
-
252
- const tree = await runner
253
- . runSchematicAsync ( 'nest-add' , options , nestTree )
254
- . toPromise ( ) ;
218
+ await runner . runExternalSchematic (
219
+ '@nestjs/schematics' ,
220
+ 'sub-app' ,
221
+ {
222
+ name : projectName
223
+ } ,
224
+ nestTree
225
+ ) ;
226
+
227
+ const tree = await runner . runSchematic ( 'nest-add' , options , nestTree ) ;
255
228
const fileContent = getFileContent (
256
229
tree ,
257
230
`/apps/${ projectName } /src/main.azure.ts`
@@ -270,20 +243,16 @@ describe('Schematic Tests Nest Add', () => {
270
243
sourceRoot : `apps/${ projectName } /src`
271
244
} ;
272
245
273
- await runner
274
- . runExternalSchematicAsync (
275
- '@nestjs/schematics' ,
276
- 'sub-app' ,
277
- {
278
- name : projectName
279
- } ,
280
- nestTree
281
- )
282
- . toPromise ( ) ;
283
-
284
- const tree = await runner
285
- . runSchematicAsync ( 'nest-add' , options , nestTree )
286
- . toPromise ( ) ;
246
+ await runner . runExternalSchematic (
247
+ '@nestjs/schematics' ,
248
+ 'sub-app' ,
249
+ {
250
+ name : projectName
251
+ } ,
252
+ nestTree
253
+ ) ;
254
+
255
+ const tree = await runner . runSchematic ( 'nest-add' , options , nestTree ) ;
287
256
const fileContent = getFileContent ( tree , `/${ projectName } /index.ts` ) ;
288
257
289
258
expect ( fileContent ) . toContain (
@@ -300,19 +269,15 @@ describe('Schematic Tests Nest Add', () => {
300
269
sourceRoot : `apps/${ projectName } /src`
301
270
} ;
302
271
303
- await runner
304
- . runExternalSchematicAsync (
305
- '@nestjs/schematics' ,
306
- 'sub-app' ,
307
- {
308
- name : projectName
309
- } ,
310
- nestTree
311
- )
312
- . toPromise ( ) ;
313
- const tree = await runner
314
- . runSchematicAsync ( 'nest-add' , options , nestTree )
315
- . toPromise ( ) ;
272
+ await runner . runExternalSchematic (
273
+ '@nestjs/schematics' ,
274
+ 'sub-app' ,
275
+ {
276
+ name : projectName
277
+ } ,
278
+ nestTree
279
+ ) ;
280
+ const tree = await runner . runSchematic ( 'nest-add' , options , nestTree ) ;
316
281
317
282
const fileContent = getFileContent (
318
283
tree ,
@@ -329,19 +294,15 @@ describe('Schematic Tests Nest Add', () => {
329
294
sourceRoot : `apps/${ projectName } /src`
330
295
} ;
331
296
332
- await runner
333
- . runExternalSchematicAsync (
334
- '@nestjs/schematics' ,
335
- 'sub-app' ,
336
- {
337
- name : projectName
338
- } ,
339
- nestTree
340
- )
341
- . toPromise ( ) ;
342
- const tree = await runner
343
- . runSchematicAsync ( 'nest-add' , options , nestTree )
344
- . toPromise ( ) ;
297
+ await runner . runExternalSchematic (
298
+ '@nestjs/schematics' ,
299
+ 'sub-app' ,
300
+ {
301
+ name : projectName
302
+ } ,
303
+ nestTree
304
+ ) ;
305
+ const tree = await runner . runSchematic ( 'nest-add' , options , nestTree ) ;
345
306
346
307
const fileContent = getFileContent ( tree , 'nest-cli.json' ) ;
347
308
const parsedFile = JSON . parse ( fileContent ) ;
@@ -362,19 +323,15 @@ describe('Schematic Tests Nest Add', () => {
362
323
sourceRoot : `apps/${ projectName } /src`
363
324
} ;
364
325
365
- await runner
366
- . runExternalSchematicAsync (
367
- '@nestjs/schematics' ,
368
- 'sub-app' ,
369
- {
370
- name : projectName
371
- } ,
372
- nestTree
373
- )
374
- . toPromise ( ) ;
375
- const tree = await runner
376
- . runSchematicAsync ( 'nest-add' , options , nestTree )
377
- . toPromise ( ) ;
326
+ await runner . runExternalSchematic (
327
+ '@nestjs/schematics' ,
328
+ 'sub-app' ,
329
+ {
330
+ name : projectName
331
+ } ,
332
+ nestTree
333
+ ) ;
334
+ const tree = await runner . runSchematic ( 'nest-add' , options , nestTree ) ;
378
335
379
336
const fileContent = getFileContent ( tree , `${ projectName } /function.json` ) ;
380
337
const parsedFile = JSON . parse ( fileContent ) ;
@@ -386,16 +343,14 @@ describe('Schematic Tests Nest Add', () => {
386
343
runner : SchematicTestRunner ,
387
344
tree ?: Tree
388
345
) : Promise < UnitTestTree > {
389
- return await runner
390
- . runExternalSchematicAsync (
391
- '@nestjs/schematics' ,
392
- 'application' ,
393
- {
394
- name : 'newproject' ,
395
- directory : '.'
396
- } ,
397
- tree
398
- )
399
- . toPromise ( ) ;
346
+ return await runner . runExternalSchematic (
347
+ '@nestjs/schematics' ,
348
+ 'application' ,
349
+ {
350
+ name : 'newproject' ,
351
+ directory : '.'
352
+ } ,
353
+ tree
354
+ ) ;
400
355
}
401
356
} ) ;
0 commit comments