@@ -87,9 +87,7 @@ describe('loadArtifacts', () => {
8787 } ) ;
8888
8989 it ( 'should load multiple artifacts without generateArtifactsCommand' , async ( ) => {
90- globSpy
91- . mockResolvedValueOnce ( [ artifactsPaths . at ( 0 ) ! ] )
92- . mockResolvedValueOnce ( [ artifactsPaths . at ( 1 ) ! ] ) ;
90+ globSpy . mockResolvedValue ( artifactsPaths ) ;
9391 readJsonFileSpy
9492 . mockResolvedValueOnce ( mockRawResults1 )
9593 . mockResolvedValueOnce ( mockRawResults2 ) ;
@@ -99,9 +97,8 @@ describe('loadArtifacts', () => {
9997 expectedLinterOutput2 ,
10098 ] ) ;
10199
102- expect ( globSpy ) . toHaveBeenCalledTimes ( 2 ) ;
103- expect ( globSpy ) . toHaveBeenNthCalledWith ( 1 , artifactsPaths . at ( 0 ) ) ;
104- expect ( globSpy ) . toHaveBeenNthCalledWith ( 2 , artifactsPaths . at ( 1 ) ) ;
100+ expect ( globSpy ) . toHaveBeenCalledTimes ( 1 ) ;
101+ expect ( globSpy ) . toHaveBeenCalledWith ( artifactsPaths ) ;
105102 expect ( readJsonFileSpy ) . toHaveBeenCalledTimes ( 2 ) ;
106103 expect ( readJsonFileSpy ) . toHaveBeenNthCalledWith ( 1 , artifactsPaths . at ( 0 ) ) ;
107104 expect ( readJsonFileSpy ) . toHaveBeenNthCalledWith ( 2 , artifactsPaths . at ( 1 ) ) ;
@@ -110,9 +107,7 @@ describe('loadArtifacts', () => {
110107 } ) ;
111108
112109 it ( 'should load artifacts with generateArtifactsCommand as string' , async ( ) => {
113- globSpy
114- . mockResolvedValueOnce ( [ artifactsPaths . at ( 0 ) ! ] )
115- . mockResolvedValueOnce ( [ artifactsPaths . at ( 1 ) ! ] ) ;
110+ globSpy . mockResolvedValue ( artifactsPaths ) ;
116111 readJsonFileSpy . mockResolvedValue ( [ ] ) ;
117112
118113 const generateArtifactsCommand = `nx run-many -t lint --parallel --max-parallel=5` ;
@@ -128,14 +123,13 @@ describe('loadArtifacts', () => {
128123 command : generateArtifactsCommand ,
129124 ignoreExitCode : true ,
130125 } ) ;
131- expect ( globSpy ) . toHaveBeenCalledTimes ( 2 ) ;
126+ expect ( globSpy ) . toHaveBeenCalledTimes ( 1 ) ;
127+ expect ( globSpy ) . toHaveBeenCalledWith ( artifactsPaths ) ;
132128 expect ( ui ( ) ) . toHaveLogged ( 'log' , `$ ${ generateArtifactsCommand } ` ) ;
133129 } ) ;
134130
135131 it ( 'should load artifacts with generateArtifactsCommand as object' , async ( ) => {
136- globSpy
137- . mockResolvedValueOnce ( [ artifactsPaths . at ( 0 ) ! ] )
138- . mockResolvedValueOnce ( [ artifactsPaths . at ( 1 ) ! ] ) ;
132+ globSpy . mockResolvedValue ( artifactsPaths ) ;
139133 readJsonFileSpy . mockResolvedValue ( [ ] ) ;
140134
141135 const generateArtifactsCommand = {
@@ -153,7 +147,8 @@ describe('loadArtifacts', () => {
153147 ...generateArtifactsCommand ,
154148 ignoreExitCode : true ,
155149 } ) ;
156- expect ( globSpy ) . toHaveBeenCalledTimes ( 2 ) ;
150+ expect ( globSpy ) . toHaveBeenCalledTimes ( 1 ) ;
151+ expect ( globSpy ) . toHaveBeenCalledWith ( artifactsPaths ) ;
157152 expect ( ui ( ) ) . toHaveLogged (
158153 'log' ,
159154 '$ nx run-many -t lint --parallel --max-parallel=5' ,
0 commit comments