@@ -137,6 +137,7 @@ describe('cache-restore', () => {
137137 ] as const ) (
138138 'restored dependencies for %s' ,
139139 async ( packageManager , toolVersion , fileHash ) => {
140+ const expectedCacheKey = `node-cache-${ platform } -${ arch } -${ packageManager } -${ fileHash } ` ;
140141 // Set workspace to the appropriate fixture folder
141142 setWorkspaceFor ( packageManager ) ;
142143 getCommandOutputSpy . mockImplementation ( ( command : string ) => {
@@ -150,12 +151,20 @@ describe('cache-restore', () => {
150151 await restoreCache ( packageManager , '' ) ;
151152 expect ( hashFilesSpy ) . toHaveBeenCalled ( ) ;
152153 expect ( infoSpy ) . toHaveBeenCalledWith (
153- `Cache restored from key: node-cache- ${ platform } - ${ arch } - ${ packageManager } - ${ fileHash } `
154+ `Cache restored from key: ${ expectedCacheKey } `
154155 ) ;
155156 expect ( infoSpy ) . not . toHaveBeenCalledWith (
156157 `${ packageManager } cache is not found`
157158 ) ;
158159 expect ( setOutputSpy ) . toHaveBeenCalledWith ( 'cache-hit' , true ) ;
160+ expect ( setOutputSpy ) . toHaveBeenCalledWith (
161+ 'cache-primary-key' ,
162+ expectedCacheKey
163+ ) ;
164+ expect ( setOutputSpy ) . toHaveBeenCalledWith (
165+ 'cache-matched-key' ,
166+ expectedCacheKey
167+ ) ;
159168 }
160169 ) ;
161170 } ) ;
@@ -169,6 +178,7 @@ describe('cache-restore', () => {
169178 ] as const ) (
170179 'dependencies are changed %s' ,
171180 async ( packageManager , toolVersion , fileHash ) => {
181+ const expectedCacheKey = `node-cache-${ platform } -${ arch } -${ packageManager } -${ fileHash } ` ;
172182 // Set workspace to the appropriate fixture folder
173183 setWorkspaceFor ( packageManager ) ;
174184 getCommandOutputSpy . mockImplementation ( ( command : string ) => {
@@ -186,6 +196,14 @@ describe('cache-restore', () => {
186196 `${ packageManager } cache is not found`
187197 ) ;
188198 expect ( setOutputSpy ) . toHaveBeenCalledWith ( 'cache-hit' , false ) ;
199+ expect ( setOutputSpy ) . toHaveBeenCalledWith (
200+ 'cache-primary-key' ,
201+ expectedCacheKey
202+ ) ;
203+ expect ( setOutputSpy ) . toHaveBeenCalledWith (
204+ 'cache-matched-key' ,
205+ undefined
206+ ) ;
189207 }
190208 ) ;
191209 } ) ;
0 commit comments