@@ -115,13 +115,21 @@ describe('runInCI', () => {
115
115
break ;
116
116
117
117
case 'print-config' :
118
- stdout = await readFile ( fixturePaths . config , 'utf8' ) ;
118
+ let content = await readFile ( fixturePaths . config , 'utf8' ) ;
119
119
if ( nxMatch ) {
120
120
// simulate effect of custom persist.outputDir per Nx project
121
- const config = JSON . parse ( stdout ) as CoreConfig ;
121
+ const config = JSON . parse ( content ) as CoreConfig ;
122
122
// eslint-disable-next-line functional/immutable-data
123
123
config . persist ! . outputDir = outputDir ;
124
- stdout = JSON . stringify ( config , null , 2 ) ;
124
+ content = JSON . stringify ( config , null , 2 ) ;
125
+ }
126
+ const outputFile = args
127
+ ?. find ( arg => arg . startsWith ( '--output=' ) )
128
+ ?. split ( '=' ) [ 1 ] ;
129
+ if ( outputFile ) {
130
+ await writeFile ( path . join ( cwd as string , outputFile ) , content ) ;
131
+ } else {
132
+ stdout = content ;
125
133
}
126
134
break ;
127
135
@@ -235,7 +243,7 @@ describe('runInCI', () => {
235
243
expect ( utils . executeProcess ) . toHaveBeenCalledTimes ( 2 ) ;
236
244
expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 1 , {
237
245
command : options . bin ,
238
- args : [ 'print-config' ] ,
246
+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
239
247
cwd : workDir ,
240
248
} satisfies utils . ProcessConfig ) ;
241
249
expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 2 , {
@@ -307,7 +315,7 @@ describe('runInCI', () => {
307
315
expect ( utils . executeProcess ) . toHaveBeenCalledTimes ( 5 ) ;
308
316
expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 1 , {
309
317
command : options . bin ,
310
- args : [ 'print-config' ] ,
318
+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
311
319
cwd : workDir ,
312
320
} satisfies utils . ProcessConfig ) ;
313
321
expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 2 , {
@@ -317,7 +325,7 @@ describe('runInCI', () => {
317
325
} satisfies utils . ProcessConfig ) ;
318
326
expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 3 , {
319
327
command : options . bin ,
320
- args : [ 'print-config' ] ,
328
+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
321
329
cwd : workDir ,
322
330
} satisfies utils . ProcessConfig ) ;
323
331
expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 4 , {
@@ -383,7 +391,7 @@ describe('runInCI', () => {
383
391
expect ( utils . executeProcess ) . toHaveBeenCalledTimes ( 3 ) ;
384
392
expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 1 , {
385
393
command : options . bin ,
386
- args : [ 'print-config' ] ,
394
+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
387
395
cwd : workDir ,
388
396
} satisfies utils . ProcessConfig ) ;
389
397
expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 2 , {
@@ -577,7 +585,7 @@ describe('runInCI', () => {
577
585
) . toHaveLength ( 4 ) ; // 1 autorun for all projects, 3 print-configs for each project
578
586
expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
579
587
command : run ,
580
- args : [ 'print-config' ] ,
588
+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
581
589
cwd : expect . stringContaining ( workDir ) ,
582
590
} satisfies utils . ProcessConfig ) ;
583
591
expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
@@ -746,7 +754,7 @@ describe('runInCI', () => {
746
754
) . toHaveLength ( 10 ) ;
747
755
expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
748
756
command : run ,
749
- args : [ 'print-config' ] ,
757
+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
750
758
cwd : expect . stringContaining ( workDir ) ,
751
759
} satisfies utils . ProcessConfig ) ;
752
760
expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
@@ -922,7 +930,7 @@ describe('runInCI', () => {
922
930
) . toHaveLength ( 6 ) ; // 3 autoruns and 3 print-configs for each project
923
931
expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
924
932
command : options . bin ,
925
- args : [ 'print-config' ] ,
933
+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
926
934
cwd : expect . stringContaining ( workDir ) ,
927
935
} satisfies utils . ProcessConfig ) ;
928
936
expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
@@ -1077,7 +1085,7 @@ describe('runInCI', () => {
1077
1085
) . toHaveLength ( 10 ) ;
1078
1086
expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
1079
1087
command : options . bin ,
1080
- args : [ 'print-config' ] ,
1088
+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
1081
1089
cwd : expect . stringContaining ( workDir ) ,
1082
1090
} satisfies utils . ProcessConfig ) ;
1083
1091
expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
0 commit comments