diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts index 59abd129..5d03c408 100644 --- a/__tests__/installer.test.ts +++ b/__tests__/installer.test.ts @@ -911,42 +911,43 @@ describe('setup-node', () => { }); describe('latest alias syntax', () => { - it.each(['latest', 'current', 'node'])('download the %s version if alias is provided', async (inputVersion) => { - // Arrange - inputs['node-version'] = inputVersion; + it.each(['latest', 'current', 'node'])( + 'download the %s version if alias is provided', + async inputVersion => { + // Arrange + inputs['node-version'] = inputVersion; - os.platform = 'darwin'; - os.arch = 'x64'; + os.platform = 'darwin'; + 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(() => ''); - getManifestSpy.mockImplementation(() => { - throw new Error('Unable to download manifest'); - }); + findSpy.mockImplementation(() => ''); + getManifestSpy.mockImplementation(() => { + throw new Error('Unable to download manifest'); + }); - // Act - await main.run(); + // Act + await main.run(); - // Assert - expect(logSpy).toHaveBeenCalledWith( - `Attempting to download ${inputVersion}...` - ); + // Assert + expect(logSpy).toHaveBeenCalledWith( + `Attempting to download ${inputVersion}...` + ); - expect(logSpy).toHaveBeenCalledWith( - 'Unable to download manifest' - ); + expect(logSpy).toHaveBeenCalledWith('Unable to download manifest'); - expect(logSpy).toHaveBeenCalledWith( - 'getting latest node version...' - ); + expect(logSpy).toHaveBeenCalledWith('getting latest node version...'); - expect(logSpy).toHaveBeenCalledWith( - `Acquiring ${expectedVersion.version.substring(1, expectedVersion.version.length)} - ${os.arch} from ${expectedUrl}` - ); - - }); + expect(logSpy).toHaveBeenCalledWith( + `Acquiring ${expectedVersion.version.substring( + 1, + expectedVersion.version.length + )} - ${os.arch} from ${expectedUrl}` + ); + } + ); }); }); diff --git a/src/installer.ts b/src/installer.ts index d2db9acd..0a6b1f10 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -374,7 +374,11 @@ async function queryDistForMatch( let versions: string[] = []; 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...`); return nodeVersions[0].version; }