@@ -282,6 +282,43 @@ describe('setup-node', () => {
282282 expect ( cnSpy ) . toHaveBeenCalledWith ( `::add-path::${ expPath } ${ osm . EOL } ` ) ;
283283 } ) ;
284284
285+ it ( 'falls back to a version from node dist from mirror' , async ( ) => {
286+ os . platform = 'linux' ;
287+ os . arch = 'x64' ;
288+
289+ // a version which is not in the manifest but is in node dist
290+ const versionSpec = '11.15.0' ;
291+ const mirror = 'https://my_mirror_url' ;
292+ inputs [ 'node-version' ] = versionSpec ;
293+ inputs [ 'always-auth' ] = false ;
294+ inputs [ 'token' ] = 'faketoken' ;
295+ inputs [ 'mirror' ] = mirror ;
296+ inputs [ 'mirror-token' ] = 'faketoken' ;
297+
298+ // ... but not in the local cache
299+ findSpy . mockImplementation ( ( ) => '' ) ;
300+
301+ dlSpy . mockImplementation ( async ( ) => '/some/temp/path' ) ;
302+ const toolPath = path . normalize ( '/cache/node/11.15.0/x64' ) ;
303+ exSpy . mockImplementation ( async ( ) => '/some/other/temp/path' ) ;
304+ cacheSpy . mockImplementation ( async ( ) => toolPath ) ;
305+
306+ await main . run ( ) ;
307+
308+ const expPath = path . join ( toolPath , 'bin' ) ;
309+
310+ expect ( getManifestSpy ) . toHaveBeenCalled ( ) ;
311+ expect ( logSpy ) . toHaveBeenCalledWith (
312+ `Attempting to download ${ versionSpec } ...`
313+ ) ;
314+ expect ( logSpy ) . toHaveBeenCalledWith (
315+ `Not found in manifest. Falling back to download directly from ${ mirror } `
316+ ) ;
317+ expect ( dlSpy ) . toHaveBeenCalled ( ) ;
318+ expect ( exSpy ) . toHaveBeenCalled ( ) ;
319+ expect ( cnSpy ) . toHaveBeenCalledWith ( `::add-path::${ expPath } ${ osm . EOL } ` ) ;
320+ } ) ;
321+
285322 it ( 'falls back to a version from node dist' , async ( ) => {
286323 os . platform = 'linux' ;
287324 os . arch = 'x64' ;
0 commit comments