mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 01:33:33 +00:00 
			
		
		
		
	apply prettier
This commit is contained in:
		
							parent
							
								
									abfc09feda
								
							
						
					
					
						commit
						9d28777916
					
				@ -911,42 +911,43 @@ describe('setup-node', () => {
 | 
				
			|||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('latest alias syntax', () => {
 | 
					  describe('latest alias syntax', () => {
 | 
				
			||||||
    it.each(['latest', 'current', 'node'])('download the %s version if alias is provided', async (inputVersion) => {
 | 
					    it.each(['latest', 'current', 'node'])(
 | 
				
			||||||
      // Arrange
 | 
					      'download the %s version if alias is provided',
 | 
				
			||||||
      inputs['node-version'] = inputVersion;
 | 
					      async inputVersion => {
 | 
				
			||||||
 | 
					        // Arrange
 | 
				
			||||||
 | 
					        inputs['node-version'] = inputVersion;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      os.platform = 'darwin';
 | 
					        os.platform = 'darwin';
 | 
				
			||||||
      os.arch = 'x64';
 | 
					        os.arch = 'x64';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const expectedVersion = nodeTestDist[0];
 | 
					        const expectedVersion = nodeTestDist[0];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      let expectedUrl = `https://nodejs.org/dist/${expectedVersion.version}/node-${expectedVersion.version}-${os.platform}-${os.arch}.tar.gz`;
 | 
					        let expectedUrl = `https://nodejs.org/dist/${expectedVersion.version}/node-${expectedVersion.version}-${os.platform}-${os.arch}.tar.gz`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      findSpy.mockImplementation(() => '');
 | 
					        findSpy.mockImplementation(() => '');
 | 
				
			||||||
      getManifestSpy.mockImplementation(() => {
 | 
					        getManifestSpy.mockImplementation(() => {
 | 
				
			||||||
        throw new Error('Unable to download manifest');
 | 
					          throw new Error('Unable to download manifest');
 | 
				
			||||||
      });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // Act
 | 
					        // Act
 | 
				
			||||||
      await main.run();
 | 
					        await main.run();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // Assert
 | 
					        // Assert
 | 
				
			||||||
      expect(logSpy).toHaveBeenCalledWith(
 | 
					        expect(logSpy).toHaveBeenCalledWith(
 | 
				
			||||||
        `Attempting to download ${inputVersion}...`
 | 
					          `Attempting to download ${inputVersion}...`
 | 
				
			||||||
      );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(logSpy).toHaveBeenCalledWith(
 | 
					        expect(logSpy).toHaveBeenCalledWith('Unable to download manifest');
 | 
				
			||||||
        'Unable to download manifest'
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(logSpy).toHaveBeenCalledWith(
 | 
					        expect(logSpy).toHaveBeenCalledWith('getting latest node version...');
 | 
				
			||||||
        'getting latest node version...'
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(logSpy).toHaveBeenCalledWith(
 | 
					        expect(logSpy).toHaveBeenCalledWith(
 | 
				
			||||||
        `Acquiring ${expectedVersion.version.substring(1, expectedVersion.version.length)} - ${os.arch} from ${expectedUrl}`
 | 
					          `Acquiring ${expectedVersion.version.substring(
 | 
				
			||||||
      );
 | 
					            1,
 | 
				
			||||||
 | 
					            expectedVersion.version.length
 | 
				
			||||||
    });
 | 
					          )} - ${os.arch} from ${expectedUrl}`
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
				
			|||||||
@ -374,7 +374,11 @@ async function queryDistForMatch(
 | 
				
			|||||||
  let versions: string[] = [];
 | 
					  let versions: string[] = [];
 | 
				
			||||||
  let nodeVersions = await installer.getVersionsFromDist();
 | 
					  let nodeVersions = await installer.getVersionsFromDist();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (versionSpec === 'current' || versionSpec === 'latest' || versionSpec === 'node') {
 | 
					  if (
 | 
				
			||||||
 | 
					    versionSpec === 'current' ||
 | 
				
			||||||
 | 
					    versionSpec === 'latest' ||
 | 
				
			||||||
 | 
					    versionSpec === 'node'
 | 
				
			||||||
 | 
					  ) {
 | 
				
			||||||
    core.info(`getting latest node version...`);
 | 
					    core.info(`getting latest node version...`);
 | 
				
			||||||
    return nodeVersions[0].version;
 | 
					    return nodeVersions[0].version;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user