@@ -115,13 +115,21 @@ describe('runInCI', () => {
115115 break ;
116116
117117 case 'print-config' :
118- stdout = await readFile ( fixturePaths . config , 'utf8' ) ;
118+ let content = await readFile ( fixturePaths . config , 'utf8' ) ;
119119 if ( nxMatch ) {
120120 // 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 ;
122122 // eslint-disable-next-line functional/immutable-data
123123 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 ;
125133 }
126134 break ;
127135
@@ -235,7 +243,7 @@ describe('runInCI', () => {
235243 expect ( utils . executeProcess ) . toHaveBeenCalledTimes ( 2 ) ;
236244 expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 1 , {
237245 command : options . bin ,
238- args : [ 'print-config' ] ,
246+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
239247 cwd : workDir ,
240248 } satisfies utils . ProcessConfig ) ;
241249 expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 2 , {
@@ -307,7 +315,7 @@ describe('runInCI', () => {
307315 expect ( utils . executeProcess ) . toHaveBeenCalledTimes ( 5 ) ;
308316 expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 1 , {
309317 command : options . bin ,
310- args : [ 'print-config' ] ,
318+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
311319 cwd : workDir ,
312320 } satisfies utils . ProcessConfig ) ;
313321 expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 2 , {
@@ -317,7 +325,7 @@ describe('runInCI', () => {
317325 } satisfies utils . ProcessConfig ) ;
318326 expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 3 , {
319327 command : options . bin ,
320- args : [ 'print-config' ] ,
328+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
321329 cwd : workDir ,
322330 } satisfies utils . ProcessConfig ) ;
323331 expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 4 , {
@@ -383,7 +391,7 @@ describe('runInCI', () => {
383391 expect ( utils . executeProcess ) . toHaveBeenCalledTimes ( 3 ) ;
384392 expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 1 , {
385393 command : options . bin ,
386- args : [ 'print-config' ] ,
394+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
387395 cwd : workDir ,
388396 } satisfies utils . ProcessConfig ) ;
389397 expect ( utils . executeProcess ) . toHaveBeenNthCalledWith ( 2 , {
@@ -577,7 +585,7 @@ describe('runInCI', () => {
577585 ) . toHaveLength ( 4 ) ; // 1 autorun for all projects, 3 print-configs for each project
578586 expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
579587 command : run ,
580- args : [ 'print-config' ] ,
588+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
581589 cwd : expect . stringContaining ( workDir ) ,
582590 } satisfies utils . ProcessConfig ) ;
583591 expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
@@ -746,7 +754,7 @@ describe('runInCI', () => {
746754 ) . toHaveLength ( 10 ) ;
747755 expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
748756 command : run ,
749- args : [ 'print-config' ] ,
757+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
750758 cwd : expect . stringContaining ( workDir ) ,
751759 } satisfies utils . ProcessConfig ) ;
752760 expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
@@ -922,7 +930,7 @@ describe('runInCI', () => {
922930 ) . toHaveLength ( 6 ) ; // 3 autoruns and 3 print-configs for each project
923931 expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
924932 command : options . bin ,
925- args : [ 'print-config' ] ,
933+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
926934 cwd : expect . stringContaining ( workDir ) ,
927935 } satisfies utils . ProcessConfig ) ;
928936 expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
@@ -1077,7 +1085,7 @@ describe('runInCI', () => {
10771085 ) . toHaveLength ( 10 ) ;
10781086 expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
10791087 command : options . bin ,
1080- args : [ 'print-config' ] ,
1088+ args : [ 'print-config' , expect . stringMatching ( / ^ - - o u t p u t = . * \. j s o n $ / ) ] ,
10811089 cwd : expect . stringContaining ( workDir ) ,
10821090 } satisfies utils . ProcessConfig ) ;
10831091 expect ( utils . executeProcess ) . toHaveBeenCalledWith ( {
0 commit comments