From 2ec9d4f5f20a1c71cbf48fce1941c4e73988bac1 Mon Sep 17 00:00:00 2001 From: m0dulev1 <73461919+m0dulev1@users.noreply.github.com> Date: Mon, 7 Feb 2022 03:25:12 -0800 Subject: [PATCH] Delete __tests__ directory (#2) --- __tests__/authutil.test.ts | 135 ---- __tests__/cache-restore.test.ts | 180 ------ __tests__/cache-save.test.ts | 303 --------- __tests__/cache-utils.test.ts | 58 -- __tests__/data/.nvmrc | 1 - __tests__/data/node-dist-index.json | 770 ----------------------- __tests__/data/package-lock.json | 395 ------------ __tests__/data/pnpm-lock.yaml | 360 ----------- __tests__/data/versions-manifest.json | 157 ----- __tests__/data/yarn.lock | 368 ----------- __tests__/installer.test.ts | 864 -------------------------- __tests__/problem-matcher.test.ts | 43 -- __tests__/verify-arch.sh | 11 - __tests__/verify-node.sh | 23 - 14 files changed, 3668 deletions(-) delete mode 100644 __tests__/authutil.test.ts delete mode 100644 __tests__/cache-restore.test.ts delete mode 100644 __tests__/cache-save.test.ts delete mode 100644 __tests__/cache-utils.test.ts delete mode 100644 __tests__/data/.nvmrc delete mode 100644 __tests__/data/node-dist-index.json delete mode 100644 __tests__/data/package-lock.json delete mode 100644 __tests__/data/pnpm-lock.yaml delete mode 100644 __tests__/data/versions-manifest.json delete mode 100644 __tests__/data/yarn.lock delete mode 100644 __tests__/installer.test.ts delete mode 100644 __tests__/problem-matcher.test.ts delete mode 100644 __tests__/verify-arch.sh delete mode 100755 __tests__/verify-node.sh diff --git a/__tests__/authutil.test.ts b/__tests__/authutil.test.ts deleted file mode 100644 index 1ec4e1e1..00000000 --- a/__tests__/authutil.test.ts +++ /dev/null @@ -1,135 +0,0 @@ -import os = require('os'); -import * as fs from 'fs'; -import * as path from 'path'; -import * as core from '@actions/core'; -import * as io from '@actions/io'; -import * as auth from '../src/authutil'; - -let rcFile: string; - -describe('authutil tests', () => { - const _runnerDir = path.join(__dirname, 'runner'); - - let cnSpy: jest.SpyInstance; - let logSpy: jest.SpyInstance; - let dbgSpy: jest.SpyInstance; - - beforeAll(async () => { - const randPath = path.join( - Math.random() - .toString(36) - .substring(7) - ); - console.log('::stop-commands::stoptoken'); // Disable executing of runner commands when running tests in actions - process.env['GITHUB_ENV'] = ''; // Stub out Environment file functionality so we can verify it writes to standard out (toolkit is backwards compatible) - const tempDir = path.join(_runnerDir, randPath, 'temp'); - await io.rmRF(tempDir); - await io.mkdirP(tempDir); - process.env['GITHUB_REPOSITORY'] = 'OwnerName/repo'; - process.env['RUNNER_TEMP'] = tempDir; - rcFile = path.join(tempDir, '.npmrc'); - }, 100000); - - beforeEach(async () => { - await io.rmRF(rcFile); - // if (fs.existsSync(rcFile)) { - // fs.unlinkSync(rcFile); - // } - process.env['INPUT_SCOPE'] = ''; - - // writes - cnSpy = jest.spyOn(process.stdout, 'write'); - logSpy = jest.spyOn(console, 'log'); - dbgSpy = jest.spyOn(core, 'debug'); - cnSpy.mockImplementation(line => { - // uncomment to debug - // process.stderr.write('write:' + line + '\n'); - }); - logSpy.mockImplementation(line => { - // uncomment to debug - // process.stderr.write('log:' + line + '\n'); - }); - dbgSpy.mockImplementation(msg => { - // uncomment to see debug output - // process.stderr.write(msg + '\n'); - }); - }, 100000); - - function dbg(message: string) { - process.stderr.write('dbg::' + message + '::\n'); - } - - afterAll(async () => { - if (_runnerDir) { - await io.rmRF(_runnerDir); - } - console.log('::stoptoken::'); // Re-enable executing of runner commands when running tests in actions - }, 100000); - - function readRcFile(rcFile: string) { - let rc = {}; - let contents = fs.readFileSync(rcFile, {encoding: 'utf8'}); - for (const line of contents.split(os.EOL)) { - let parts = line.split('='); - if (parts.length == 2) { - rc[parts[0].trim()] = parts[1].trim(); - } - } - return rc; - } - - it('Sets up npmrc for npmjs', async () => { - await auth.configAuthentication('https://registry.npmjs.org/', 'false'); - - expect(fs.statSync(rcFile)).toBeDefined(); - let contents = fs.readFileSync(rcFile, {encoding: 'utf8'}); - let rc = readRcFile(rcFile); - expect(rc['registry']).toBe('https://registry.npmjs.org/'); - expect(rc['always-auth']).toBe('false'); - }); - - it('Appends trailing slash to registry', async () => { - await auth.configAuthentication('https://registry.npmjs.org', 'false'); - - expect(fs.statSync(rcFile)).toBeDefined(); - let rc = readRcFile(rcFile); - expect(rc['registry']).toBe('https://registry.npmjs.org/'); - expect(rc['always-auth']).toBe('false'); - }); - - it('Configures scoped npm registries', async () => { - process.env['INPUT_SCOPE'] = 'myScope'; - await auth.configAuthentication('https://registry.npmjs.org', 'false'); - - expect(fs.statSync(rcFile)).toBeDefined(); - let rc = readRcFile(rcFile); - expect(rc['@myscope:registry']).toBe('https://registry.npmjs.org/'); - expect(rc['always-auth']).toBe('false'); - }); - - it('Automatically configures GPR scope', async () => { - await auth.configAuthentication('npm.pkg.github.com', 'false'); - - expect(fs.statSync(rcFile)).toBeDefined(); - let rc = readRcFile(rcFile); - expect(rc['@ownername:registry']).toBe('npm.pkg.github.com/'); - expect(rc['always-auth']).toBe('false'); - }); - - it('Sets up npmrc for always-auth true', async () => { - await auth.configAuthentication('https://registry.npmjs.org/', 'true'); - expect(fs.statSync(rcFile)).toBeDefined(); - let rc = readRcFile(rcFile); - expect(rc['registry']).toBe('https://registry.npmjs.org/'); - expect(rc['always-auth']).toBe('true'); - }); - it('It is already set the NODE_AUTH_TOKEN export it ', async () => { - process.env.NODE_AUTH_TOKEN = 'foobar'; - await auth.configAuthentication('npm.pkg.github.com', 'false'); - expect(fs.statSync(rcFile)).toBeDefined(); - let rc = readRcFile(rcFile); - expect(rc['@ownername:registry']).toBe('npm.pkg.github.com/'); - expect(rc['always-auth']).toBe('false'); - expect(process.env.NODE_AUTH_TOKEN).toEqual('foobar'); - }); -}); diff --git a/__tests__/cache-restore.test.ts b/__tests__/cache-restore.test.ts deleted file mode 100644 index 27f6fa27..00000000 --- a/__tests__/cache-restore.test.ts +++ /dev/null @@ -1,180 +0,0 @@ -import * as core from '@actions/core'; -import * as cache from '@actions/cache'; -import * as path from 'path'; -import * as glob from '@actions/glob'; - -import * as utils from '../src/cache-utils'; -import {restoreCache} from '../src/cache-restore'; - -describe('cache-restore', () => { - process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data'); - if (!process.env.RUNNER_OS) { - process.env.RUNNER_OS = 'Linux'; - } - const platform = process.env.RUNNER_OS; - const commonPath = '/some/random/path'; - const npmCachePath = `${commonPath}/npm`; - const pnpmCachePath = `${commonPath}/pnpm`; - const yarn1CachePath = `${commonPath}/yarn1`; - const yarn2CachePath = `${commonPath}/yarn2`; - const yarnFileHash = - 'b8a0bae5243251f7c07dd52d1f78ff78281dfefaded700a176261b6b54fa245b'; - const npmFileHash = - 'abf7c9b306a3149dcfba4673e2362755503bcceaab46f0e4e6fee0ade493e20c'; - const pnpmFileHash = - '26309058093e84713f38869c50cf1cee9b08155ede874ec1b44ce3fca8c68c70'; - const cachesObject = { - [npmCachePath]: npmFileHash, - [pnpmCachePath]: pnpmFileHash, - [yarn1CachePath]: yarnFileHash, - [yarn2CachePath]: yarnFileHash - }; - - function findCacheFolder(command: string) { - switch (command) { - case utils.supportedPackageManagers.npm.getCacheFolderCommand: - return npmCachePath; - case utils.supportedPackageManagers.pnpm.getCacheFolderCommand: - return pnpmCachePath; - case utils.supportedPackageManagers.yarn1.getCacheFolderCommand: - return yarn1CachePath; - case utils.supportedPackageManagers.yarn2.getCacheFolderCommand: - return yarn2CachePath; - default: - return 'packge/not/found'; - } - } - - let saveStateSpy: jest.SpyInstance; - let infoSpy: jest.SpyInstance; - let debugSpy: jest.SpyInstance; - let setOutputSpy: jest.SpyInstance; - let getCommandOutputSpy: jest.SpyInstance; - let restoreCacheSpy: jest.SpyInstance; - let hashFilesSpy: jest.SpyInstance; - - beforeEach(() => { - // core - infoSpy = jest.spyOn(core, 'info'); - infoSpy.mockImplementation(() => undefined); - - debugSpy = jest.spyOn(core, 'debug'); - debugSpy.mockImplementation(() => undefined); - - setOutputSpy = jest.spyOn(core, 'setOutput'); - setOutputSpy.mockImplementation(() => undefined); - - saveStateSpy = jest.spyOn(core, 'saveState'); - saveStateSpy.mockImplementation(() => undefined); - - // glob - hashFilesSpy = jest.spyOn(glob, 'hashFiles'); - hashFilesSpy.mockImplementation((pattern: string) => { - if (pattern.includes('package-lock.json')) { - return npmFileHash; - } else if (pattern.includes('pnpm-lock.yaml')) { - return pnpmFileHash; - } else if (pattern.includes('yarn.lock')) { - return yarnFileHash; - } else { - return ''; - } - }); - - // cache - restoreCacheSpy = jest.spyOn(cache, 'restoreCache'); - restoreCacheSpy.mockImplementation( - (cachePaths: Array, key: string) => { - if (!cachePaths || cachePaths.length === 0) { - return undefined; - } - - const cachPath = cachePaths[0]; - const fileHash = cachesObject[cachPath]; - - if (key.includes(fileHash)) { - return key; - } - - return undefined; - } - ); - - // cache-utils - getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput'); - }); - - describe('Validate provided package manager', () => { - it.each([['npm7'], ['npm6'], ['pnpm6'], ['yarn1'], ['yarn2'], ['random']])( - 'Throw an error because %s is not supported', - async packageManager => { - await expect(restoreCache(packageManager)).rejects.toThrowError( - `Caching for '${packageManager}' is not supported` - ); - } - ); - }); - - describe('Restore dependencies', () => { - it.each([ - ['yarn', '2.1.2', yarnFileHash], - ['yarn', '1.2.3', yarnFileHash], - ['npm', '', npmFileHash], - ['pnpm', '', pnpmFileHash] - ])( - 'restored dependencies for %s', - async (packageManager, toolVersion, fileHash) => { - getCommandOutputSpy.mockImplementation((command: string) => { - if (command.includes('version')) { - return toolVersion; - } else { - return findCacheFolder(command); - } - }); - - await restoreCache(packageManager); - expect(hashFilesSpy).toHaveBeenCalled(); - expect(infoSpy).toHaveBeenCalledWith( - `Cache restored from key: node-cache-${platform}-${packageManager}-${fileHash}` - ); - expect(infoSpy).not.toHaveBeenCalledWith( - `${packageManager} cache is not found` - ); - expect(setOutputSpy).toHaveBeenCalledWith('cache-hit', true); - } - ); - }); - - describe('Dependencies changed', () => { - it.each([ - ['yarn', '2.1.2', yarnFileHash], - ['yarn', '1.2.3', yarnFileHash], - ['npm', '', npmFileHash], - ['pnpm', '', pnpmFileHash] - ])( - 'dependencies are changed %s', - async (packageManager, toolVersion, fileHash) => { - getCommandOutputSpy.mockImplementation((command: string) => { - if (command.includes('version')) { - return toolVersion; - } else { - return findCacheFolder(command); - } - }); - - restoreCacheSpy.mockImplementationOnce(() => undefined); - await restoreCache(packageManager); - expect(hashFilesSpy).toHaveBeenCalled(); - expect(infoSpy).toHaveBeenCalledWith( - `${packageManager} cache is not found` - ); - expect(setOutputSpy).toHaveBeenCalledWith('cache-hit', false); - } - ); - }); - - afterEach(() => { - jest.resetAllMocks(); - jest.clearAllMocks(); - }); -}); diff --git a/__tests__/cache-save.test.ts b/__tests__/cache-save.test.ts deleted file mode 100644 index 82db2195..00000000 --- a/__tests__/cache-save.test.ts +++ /dev/null @@ -1,303 +0,0 @@ -import * as core from '@actions/core'; -import * as cache from '@actions/cache'; -import * as glob from '@actions/glob'; -import fs from 'fs'; -import path from 'path'; - -import * as utils from '../src/cache-utils'; -import {run} from '../src/cache-save'; -import {State} from '../src/constants'; - -describe('run', () => { - const yarnFileHash = - 'b8a0bae5243251f7c07dd52d1f78ff78281dfefaded700a176261b6b54fa245b'; - const npmFileHash = - 'abf7c9b306a3149dcfba4673e2362755503bcceaab46f0e4e6fee0ade493e20c'; - const pnpmFileHash = - '26309058093e84713f38869c50cf1cee9b08155ede874ec1b44ce3fca8c68c70'; - const commonPath = '/some/random/path'; - process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data'); - - let inputs = {} as any; - - let getInputSpy: jest.SpyInstance; - let infoSpy: jest.SpyInstance; - let warningSpy: jest.SpyInstance; - let debugSpy: jest.SpyInstance; - let setFailedSpy: jest.SpyInstance; - let getStateSpy: jest.SpyInstance; - let saveCacheSpy: jest.SpyInstance; - let getCommandOutputSpy: jest.SpyInstance; - let hashFilesSpy: jest.SpyInstance; - let existsSpy: jest.SpyInstance; - - beforeEach(() => { - getInputSpy = jest.spyOn(core, 'getInput'); - getInputSpy.mockImplementation((name: string) => inputs[name]); - - infoSpy = jest.spyOn(core, 'info'); - infoSpy.mockImplementation(() => undefined); - - warningSpy = jest.spyOn(core, 'warning'); - warningSpy.mockImplementation(() => undefined); - - setFailedSpy = jest.spyOn(core, 'setFailed'); - setFailedSpy.mockImplementation(() => undefined); - - debugSpy = jest.spyOn(core, 'debug'); - debugSpy.mockImplementation(() => undefined); - - getStateSpy = jest.spyOn(core, 'getState'); - - // cache - saveCacheSpy = jest.spyOn(cache, 'saveCache'); - saveCacheSpy.mockImplementation(() => undefined); - - // glob - hashFilesSpy = jest.spyOn(glob, 'hashFiles'); - hashFilesSpy.mockImplementation((pattern: string) => { - if (pattern.includes('package-lock.json')) { - return npmFileHash; - } else if (pattern.includes('yarn.lock')) { - return yarnFileHash; - } else { - return ''; - } - }); - - existsSpy = jest.spyOn(fs, 'existsSync'); - existsSpy.mockImplementation(() => true); - - // utils - getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput'); - }); - - afterEach(() => { - existsSpy.mockRestore(); - }); - - describe('Package manager validation', () => { - it('Package manager is not provided, skip caching', async () => { - inputs['cache'] = ''; - - await run(); - - expect(setFailedSpy).not.toHaveBeenCalled(); - expect(infoSpy).not.toHaveBeenCalled(); - expect(saveCacheSpy).not.toHaveBeenCalled(); - expect(debugSpy).toHaveBeenLastCalledWith( - "Caching for '' is not supported" - ); - }); - - it('Package manager is not valid, skip caching', async () => { - inputs['cache'] = 'yarn3'; - - await run(); - - expect(setFailedSpy).not.toHaveBeenCalled(); - expect(infoSpy).not.toHaveBeenCalled(); - expect(saveCacheSpy).not.toHaveBeenCalled(); - expect(debugSpy).toHaveBeenLastCalledWith( - "Caching for 'yarn3' is not supported" - ); - }); - }); - - describe('Validate unchanged cache is not saved', () => { - it('should not save cache for yarn1', async () => { - inputs['cache'] = 'yarn'; - getStateSpy.mockImplementation(() => yarnFileHash); - getCommandOutputSpy - .mockImplementationOnce(() => '1.2.3') - .mockImplementationOnce(() => `${commonPath}/yarn1`); - - await run(); - - expect(getInputSpy).toHaveBeenCalled(); - expect(getStateSpy).toHaveBeenCalledTimes(2); - expect(getCommandOutputSpy).toHaveBeenCalledTimes(2); - expect(debugSpy).toHaveBeenCalledWith(`yarn path is ${commonPath}/yarn1`); - expect(debugSpy).toHaveBeenCalledWith('Consumed yarn version is 1.2.3'); - expect(infoSpy).toHaveBeenCalledWith( - `Cache hit occurred on the primary key ${yarnFileHash}, not saving cache.` - ); - expect(setFailedSpy).not.toHaveBeenCalled(); - }); - - it('should not save cache for yarn2', async () => { - inputs['cache'] = 'yarn'; - getStateSpy.mockImplementation(() => yarnFileHash); - getCommandOutputSpy - .mockImplementationOnce(() => '2.2.3') - .mockImplementationOnce(() => `${commonPath}/yarn2`); - - await run(); - - expect(getInputSpy).toHaveBeenCalled(); - expect(getStateSpy).toHaveBeenCalledTimes(2); - expect(getCommandOutputSpy).toHaveBeenCalledTimes(2); - expect(debugSpy).toHaveBeenCalledWith(`yarn path is ${commonPath}/yarn2`); - expect(debugSpy).toHaveBeenCalledWith('Consumed yarn version is 2.2.3'); - expect(infoSpy).toHaveBeenCalledWith( - `Cache hit occurred on the primary key ${yarnFileHash}, not saving cache.` - ); - expect(setFailedSpy).not.toHaveBeenCalled(); - }); - - it('should not save cache for npm', async () => { - inputs['cache'] = 'npm'; - getStateSpy.mockImplementation(() => npmFileHash); - getCommandOutputSpy.mockImplementationOnce(() => `${commonPath}/npm`); - - await run(); - - expect(getInputSpy).toHaveBeenCalled(); - expect(getStateSpy).toHaveBeenCalledTimes(2); - expect(getCommandOutputSpy).toHaveBeenCalledTimes(1); - expect(debugSpy).toHaveBeenCalledWith(`npm path is ${commonPath}/npm`); - expect(infoSpy).toHaveBeenCalledWith( - `Cache hit occurred on the primary key ${npmFileHash}, not saving cache.` - ); - expect(setFailedSpy).not.toHaveBeenCalled(); - }); - - it('should not save cache for pnpm', async () => { - inputs['cache'] = 'pnpm'; - getStateSpy.mockImplementation(() => pnpmFileHash); - getCommandOutputSpy.mockImplementationOnce(() => `${commonPath}/pnpm`); - - await run(); - - expect(getInputSpy).toHaveBeenCalled(); - expect(getStateSpy).toHaveBeenCalledTimes(2); - expect(getCommandOutputSpy).toHaveBeenCalledTimes(1); - expect(debugSpy).toHaveBeenCalledWith(`pnpm path is ${commonPath}/pnpm`); - expect(infoSpy).toHaveBeenCalledWith( - `Cache hit occurred on the primary key ${pnpmFileHash}, not saving cache.` - ); - expect(setFailedSpy).not.toHaveBeenCalled(); - }); - }); - - describe('action saves the cache', () => { - it('saves cache from yarn 1', async () => { - inputs['cache'] = 'yarn'; - getStateSpy.mockImplementation((name: string) => { - if (name === State.CacheMatchedKey) { - return yarnFileHash; - } else { - return npmFileHash; - } - }); - getCommandOutputSpy - .mockImplementationOnce(() => '1.2.3') - .mockImplementationOnce(() => `${commonPath}/yarn1`); - - await run(); - - expect(getInputSpy).toHaveBeenCalled(); - expect(getStateSpy).toHaveBeenCalledTimes(2); - expect(getCommandOutputSpy).toHaveBeenCalledTimes(2); - expect(debugSpy).toHaveBeenCalledWith(`yarn path is ${commonPath}/yarn1`); - expect(debugSpy).toHaveBeenCalledWith('Consumed yarn version is 1.2.3'); - expect(infoSpy).not.toHaveBeenCalledWith( - `Cache hit occurred on the primary key ${yarnFileHash}, not saving cache.` - ); - expect(saveCacheSpy).toHaveBeenCalled(); - expect(infoSpy).toHaveBeenLastCalledWith( - `Cache saved with the key: ${npmFileHash}` - ); - expect(setFailedSpy).not.toHaveBeenCalled(); - }); - - it('saves cache from yarn 2', async () => { - inputs['cache'] = 'yarn'; - getStateSpy.mockImplementation((name: string) => { - if (name === State.CacheMatchedKey) { - return yarnFileHash; - } else { - return npmFileHash; - } - }); - getCommandOutputSpy - .mockImplementationOnce(() => '2.2.3') - .mockImplementationOnce(() => `${commonPath}/yarn2`); - - await run(); - - expect(getInputSpy).toHaveBeenCalled(); - expect(getStateSpy).toHaveBeenCalledTimes(2); - expect(getCommandOutputSpy).toHaveBeenCalledTimes(2); - expect(debugSpy).toHaveBeenCalledWith(`yarn path is ${commonPath}/yarn2`); - expect(debugSpy).toHaveBeenCalledWith('Consumed yarn version is 2.2.3'); - expect(infoSpy).not.toHaveBeenCalledWith( - `Cache hit occurred on the primary key ${yarnFileHash}, not saving cache.` - ); - expect(saveCacheSpy).toHaveBeenCalled(); - expect(infoSpy).toHaveBeenLastCalledWith( - `Cache saved with the key: ${npmFileHash}` - ); - expect(setFailedSpy).not.toHaveBeenCalled(); - }); - - it('saves cache from npm', async () => { - inputs['cache'] = 'npm'; - getStateSpy.mockImplementation((name: string) => { - if (name === State.CacheMatchedKey) { - return npmFileHash; - } else { - return yarnFileHash; - } - }); - getCommandOutputSpy.mockImplementationOnce(() => `${commonPath}/npm`); - - await run(); - - expect(getInputSpy).toHaveBeenCalled(); - expect(getStateSpy).toHaveBeenCalledTimes(2); - expect(getCommandOutputSpy).toHaveBeenCalledTimes(1); - expect(debugSpy).toHaveBeenCalledWith(`npm path is ${commonPath}/npm`); - expect(infoSpy).not.toHaveBeenCalledWith( - `Cache hit occurred on the primary key ${npmFileHash}, not saving cache.` - ); - expect(saveCacheSpy).toHaveBeenCalled(); - expect(infoSpy).toHaveBeenLastCalledWith( - `Cache saved with the key: ${yarnFileHash}` - ); - expect(setFailedSpy).not.toHaveBeenCalled(); - }); - - it('saves cache from pnpm', async () => { - inputs['cache'] = 'pnpm'; - getStateSpy.mockImplementation((name: string) => { - if (name === State.CacheMatchedKey) { - return pnpmFileHash; - } else { - return npmFileHash; - } - }); - getCommandOutputSpy.mockImplementationOnce(() => `${commonPath}/pnpm`); - - await run(); - - expect(getInputSpy).toHaveBeenCalled(); - expect(getStateSpy).toHaveBeenCalledTimes(2); - expect(getCommandOutputSpy).toHaveBeenCalledTimes(1); - expect(debugSpy).toHaveBeenCalledWith(`pnpm path is ${commonPath}/pnpm`); - expect(infoSpy).not.toHaveBeenCalledWith( - `Cache hit occurred on the primary key ${pnpmFileHash}, not saving cache.` - ); - expect(saveCacheSpy).toHaveBeenCalled(); - expect(infoSpy).toHaveBeenLastCalledWith( - `Cache saved with the key: ${npmFileHash}` - ); - expect(setFailedSpy).not.toHaveBeenCalled(); - }); - }); - - afterEach(() => { - jest.resetAllMocks(); - jest.clearAllMocks(); - }); -}); diff --git a/__tests__/cache-utils.test.ts b/__tests__/cache-utils.test.ts deleted file mode 100644 index 0ceabeb0..00000000 --- a/__tests__/cache-utils.test.ts +++ /dev/null @@ -1,58 +0,0 @@ -import * as core from '@actions/core'; -import path from 'path'; -import * as utils from '../src/cache-utils'; -import {PackageManagerInfo} from '../src/cache-utils'; - -describe('cache-utils', () => { - const commonPath = '/some/random/path'; - const versionYarn1 = '1.2.3'; - const versionYarn2 = '2.3.4'; - - let debugSpy: jest.SpyInstance; - let getCommandOutputSpy: jest.SpyInstance; - - function getPackagePath(name: string) { - if (name === utils.supportedPackageManagers.npm.getCacheFolderCommand) { - return `${commonPath}/npm`; - } else if ( - name === utils.supportedPackageManagers.pnpm.getCacheFolderCommand - ) { - return `${commonPath}/pnpm`; - } else { - if (name === utils.supportedPackageManagers.yarn1.getCacheFolderCommand) { - return `${commonPath}/yarn1`; - } else { - return `${commonPath}/yarn2`; - } - } - } - - beforeEach(() => { - process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data'); - debugSpy = jest.spyOn(core, 'debug'); - debugSpy.mockImplementation(msg => {}); - - getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput'); - }); - - describe('getPackageManagerInfo', () => { - it.each<[string, PackageManagerInfo | null]>([ - ['npm', utils.supportedPackageManagers.npm], - ['pnpm', utils.supportedPackageManagers.pnpm], - ['yarn', utils.supportedPackageManagers.yarn1], - ['yarn1', null], - ['yarn2', null], - ['npm7', null] - ])('getPackageManagerInfo for %s is %o', async (packageManager, result) => { - getCommandOutputSpy.mockImplementationOnce(() => versionYarn1); - await expect(utils.getPackageManagerInfo(packageManager)).resolves.toBe( - result - ); - }); - }); - - afterEach(() => { - jest.resetAllMocks(); - jest.clearAllMocks(); - }); -}); diff --git a/__tests__/data/.nvmrc b/__tests__/data/.nvmrc deleted file mode 100644 index ca3f1e5c..00000000 --- a/__tests__/data/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -v14 \ No newline at end of file diff --git a/__tests__/data/node-dist-index.json b/__tests__/data/node-dist-index.json deleted file mode 100644 index 09cca7ca..00000000 --- a/__tests__/data/node-dist-index.json +++ /dev/null @@ -1,770 +0,0 @@ -[ - { - "version": "v14.1.0", - "date": "2020-04-29", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "6.14.4", - "v8": "8.1.307.31", - "uv": "1.37.0", - "zlib": "1.2.11", - "openssl": "1.1.1g", - "modules": "83", - "lts": false, - "security": false - }, - { - "version": "v14.0.0", - "date": "2020-04-21", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "6.14.4", - "v8": "8.1.307.30", - "uv": "1.37.0", - "zlib": "1.2.11", - "openssl": "1.1.1f", - "modules": "83", - "lts": false, - "security": false - }, - { - "version": "v13.14.0", - "date": "2020-04-28", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "6.14.4", - "v8": "7.9.317.25", - "uv": "1.37.0", - "zlib": "1.2.11", - "openssl": "1.1.1g", - "modules": "79", - "lts": false, - "security": false - }, - { - "version": "v13.13.0", - "date": "2020-04-14", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "6.14.4", - "v8": "7.9.317.25", - "uv": "1.35.0", - "zlib": "1.2.11", - "openssl": "1.1.1f", - "modules": "79", - "lts": false, - "security": false - }, - { - "version": "v12.16.3", - "date": "2020-04-28", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "6.14.4", - "v8": "7.8.279.23", - "uv": "1.34.2", - "zlib": "1.2.11", - "openssl": "1.1.1g", - "modules": "72", - "lts": "Erbium", - "security": false - }, - { - "version": "v12.16.2", - "date": "2020-04-08", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "6.14.4", - "v8": "7.8.279.23", - "uv": "1.34.2", - "zlib": "1.2.11", - "openssl": "1.1.1e", - "modules": "72", - "lts": "Erbium", - "security": false - }, - { - "version": "v12.1.0", - "date": "2019-04-29", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "6.9.0", - "v8": "7.4.288.21", - "uv": "1.28.0", - "zlib": "1.2.11", - "openssl": "1.1.1b", - "modules": "72", - "lts": false, - "security": false - }, - { - "version": "v11.15.0", - "date": "2019-04-30", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv6l", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "6.7.0", - "v8": "7.0.276.38", - "uv": "1.27.0", - "zlib": "1.2.11", - "openssl": "1.1.1b", - "modules": "67", - "lts": false, - "security": false - }, - { - "version": "v10.20.1", - "date": "2020-04-10", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv6l", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "6.14.4", - "v8": "6.8.275.32", - "uv": "1.34.2", - "zlib": "1.2.11", - "openssl": "1.1.1e", - "modules": "64", - "lts": "Dubnium", - "security": false - }, - { - "version": "v10.20.0", - "date": "2020-03-24", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv6l", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "6.14.4", - "v8": "6.8.275.32", - "uv": "1.34.2", - "zlib": "1.2.11", - "openssl": "1.1.1e", - "modules": "64", - "lts": "Dubnium", - "security": false - }, - { - "version": "v9.11.2", - "date": "2018-06-12", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv6l", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "linux-x86", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "sunos-x86", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "5.6.0", - "v8": "6.2.414.46", - "uv": "1.19.2", - "zlib": "1.2.11", - "openssl": "1.0.2o", - "modules": "59", - "lts": false, - "security": false - }, - { - "version": "v9.11.1", - "date": "2018-04-05", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv6l", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "linux-x86", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "sunos-x86", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "5.6.0", - "v8": "6.2.414.46", - "uv": "1.19.2", - "zlib": "1.2.11", - "openssl": "1.0.2o", - "modules": "59", - "lts": false, - "security": false - }, - { - "version": "v8.17.0", - "date": "2019-12-17", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv6l", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "linux-x86", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "sunos-x86", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "6.13.4", - "v8": "6.2.414.78", - "uv": "1.23.2", - "zlib": "1.2.11", - "openssl": "1.0.2s", - "modules": "57", - "lts": "Carbon", - "security": true - }, - { - "version": "v8.16.2", - "date": "2019-10-08", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv6l", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "linux-x86", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "sunos-x86", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "6.4.1", - "v8": "6.2.414.78", - "uv": "1.23.2", - "zlib": "1.2.11", - "openssl": "1.0.2s", - "modules": "57", - "lts": "Carbon", - "security": false - }, - { - "version": "v7.10.1", - "date": "2017-07-11", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv6l", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "linux-x86", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "sunos-x86", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "4.2.0", - "v8": "5.5.372.43", - "uv": "1.11.0", - "zlib": "1.2.11", - "openssl": "1.0.2k", - "modules": "51", - "lts": false, - "security": true - }, - { - "version": "v7.10.0", - "date": "2017-05-02", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv6l", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "linux-x86", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "sunos-x86", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "4.2.0", - "v8": "5.5.372.43", - "uv": "1.11.0", - "zlib": "1.2.11", - "openssl": "1.0.2k", - "modules": "51", - "lts": false, - "security": false - }, - { - "version": "v6.17.1", - "date": "2019-04-03", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv6l", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "linux-x86", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "sunos-x86", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "3.10.10", - "v8": "5.1.281.111", - "uv": "1.16.1", - "zlib": "1.2.11", - "openssl": "1.0.2r", - "modules": "48", - "lts": "Boron", - "security": false - }, - { - "version": "v6.17.0", - "date": "2019-02-28", - "files": [ - "aix-ppc64", - "headers", - "linux-arm64", - "linux-armv6l", - "linux-armv7l", - "linux-ppc64le", - "linux-s390x", - "linux-x64", - "linux-x86", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "sunos-x86", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "3.10.10", - "v8": "5.1.281.111", - "uv": "1.16.1", - "zlib": "1.2.11", - "openssl": "1.0.2r", - "modules": "48", - "lts": "Boron", - "security": true - }, - { - "version": "v5.12.0", - "date": "2016-06-23", - "files": [ - "headers", - "linux-arm64", - "linux-armv6l", - "linux-armv7l", - "linux-ppc64le", - "linux-x64", - "linux-x86", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "sunos-x86", - "win-x64-exe", - "win-x64-msi", - "win-x86-exe", - "win-x86-msi" - ], - "npm": "3.8.6", - "v8": "4.6.85.32", - "uv": "1.8.0", - "zlib": "1.2.8", - "openssl": "1.0.2h", - "modules": "47", - "lts": false, - "security": false - }, - { - "version": "v4.9.1", - "date": "2018-03-29", - "files": [ - "headers", - "linux-arm64", - "linux-armv6l", - "linux-armv7l", - "linux-ppc64le", - "linux-x64", - "linux-x86", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "sunos-x86", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "2.15.11", - "v8": "4.5.103.53", - "uv": "1.9.1", - "zlib": "1.2.11", - "openssl": "1.0.2o", - "modules": "46", - "lts": "Argon", - "security": false - }, - { - "version": "v4.9.0", - "date": "2018-03-28", - "files": [ - "headers", - "linux-arm64", - "linux-armv6l", - "linux-armv7l", - "linux-ppc64le", - "linux-x64", - "linux-x86", - "osx-x64-pkg", - "osx-x64-tar", - "src", - "sunos-x64", - "sunos-x86", - "win-x64-7z", - "win-x64-exe", - "win-x64-msi", - "win-x64-zip", - "win-x86-7z", - "win-x86-exe", - "win-x86-msi", - "win-x86-zip" - ], - "npm": "2.15.11", - "v8": "4.5.103.53", - "uv": "1.9.1", - "zlib": "1.2.11", - "openssl": "1.0.2o", - "modules": "46", - "lts": "Argon", - "security": true - }, - { - "version": "v0.12.18", - "date": "2017-02-22", - "files": [ - "headers", - "linux-x64", - "linux-x86", - "osx-x64-pkg", - "osx-x64-tar", - "osx-x86-tar", - "src", - "sunos-x86", - "win-x64-exe", - "win-x86-exe", - "win-x86-msi" - ], - "npm": "2.15.11", - "v8": "3.28.71.20", - "uv": "1.6.1", - "zlib": "1.2.8", - "openssl": "1.0.1u", - "modules": "14", - "lts": false, - "security": false - }, - { - "version": "v0.12.17", - "date": "2016-10-18", - "files": [ - "headers", - "linux-x64", - "linux-x86", - "osx-x64-pkg", - "osx-x64-tar", - "osx-x86-tar", - "src", - "sunos-x64", - "sunos-x86", - "win-x64-exe", - "win-x86-exe", - "win-x86-msi" - ], - "npm": "2.15.1", - "v8": "3.28.71.19", - "uv": "1.6.1", - "zlib": "1.2.8", - "openssl": "1.0.1u", - "modules": "14", - "lts": false, - "security": true - } -] \ No newline at end of file diff --git a/__tests__/data/package-lock.json b/__tests__/data/package-lock.json deleted file mode 100644 index 2e3a8e06..00000000 --- a/__tests__/data/package-lock.json +++ /dev/null @@ -1,395 +0,0 @@ -{ - "name": "test", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "accepts": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", - "requires": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" - } - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", - "requires": { - "bytes": "3.1.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" - } - }, - "bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" - }, - "content-disposition": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", - "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", - "requires": { - "safe-buffer": "5.1.2" - } - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, - "cookie": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, - "express": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", - "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", - "requires": { - "accepts": "~1.3.7", - "array-flatten": "1.1.1", - "body-parser": "1.19.0", - "content-disposition": "0.5.3", - "content-type": "~1.0.4", - "cookie": "0.4.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "~1.1.2", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.5", - "qs": "6.7.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.1.2", - "send": "0.17.1", - "serve-static": "1.14.1", - "setprototypeof": "1.1.1", - "statuses": "~1.5.0", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - } - }, - "finalhandler": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", - "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - } - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, - "http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - } - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "requires": { - "yallist": "^4.0.0" - } - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, - "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" - }, - "mime-db": { - "version": "1.47.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.47.0.tgz", - "integrity": "sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw==" - }, - "mime-types": { - "version": "2.1.30", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.30.tgz", - "integrity": "sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg==", - "requires": { - "mime-db": "1.47.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "negotiator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } - }, - "parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "proxy-addr": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", - "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==", - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.9.1" - } - }, - "qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" - }, - "range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" - }, - "raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", - "requires": { - "bytes": "3.1.0", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "requires": { - "lru-cache": "^6.0.0" - } - }, - "send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.7.2", - "mime": "1.6.0", - "ms": "2.1.1", - "on-finished": "~2.3.0", - "range-parser": "~1.2.1", - "statuses": "~1.5.0" - }, - "dependencies": { - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" - } - } - }, - "serve-static": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.17.1" - } - }, - "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" - }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" - }, - "toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" - }, - "type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - } - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - } - } - } \ No newline at end of file diff --git a/__tests__/data/pnpm-lock.yaml b/__tests__/data/pnpm-lock.yaml deleted file mode 100644 index f4c3963e..00000000 --- a/__tests__/data/pnpm-lock.yaml +++ /dev/null @@ -1,360 +0,0 @@ -lockfileVersion: 5.3 - -specifiers: - express: ^4.17.1 - -dependencies: - express: 4.17.1 - -packages: - - /accepts/1.3.7: - resolution: {integrity: sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==} - engines: {node: '>= 0.6'} - dependencies: - mime-types: 2.1.31 - negotiator: 0.6.2 - dev: false - - /array-flatten/1.1.1: - resolution: {integrity: sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=} - dev: false - - /body-parser/1.19.0: - resolution: {integrity: sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==} - engines: {node: '>= 0.8'} - dependencies: - bytes: 3.1.0 - content-type: 1.0.4 - debug: 2.6.9 - depd: 1.1.2 - http-errors: 1.7.2 - iconv-lite: 0.4.24 - on-finished: 2.3.0 - qs: 6.7.0 - raw-body: 2.4.0 - type-is: 1.6.18 - dev: false - - /bytes/3.1.0: - resolution: {integrity: sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==} - engines: {node: '>= 0.8'} - dev: false - - /content-disposition/0.5.3: - resolution: {integrity: sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==} - engines: {node: '>= 0.6'} - dependencies: - safe-buffer: 5.1.2 - dev: false - - /content-type/1.0.4: - resolution: {integrity: sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==} - engines: {node: '>= 0.6'} - dev: false - - /cookie-signature/1.0.6: - resolution: {integrity: sha1-4wOogrNCzD7oylE6eZmXNNqzriw=} - dev: false - - /cookie/0.4.0: - resolution: {integrity: sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==} - engines: {node: '>= 0.6'} - dev: false - - /debug/2.6.9: - resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} - dependencies: - ms: 2.0.0 - dev: false - - /depd/1.1.2: - resolution: {integrity: sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=} - engines: {node: '>= 0.6'} - dev: false - - /destroy/1.0.4: - resolution: {integrity: sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=} - dev: false - - /ee-first/1.1.1: - resolution: {integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=} - dev: false - - /encodeurl/1.0.2: - resolution: {integrity: sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=} - engines: {node: '>= 0.8'} - dev: false - - /escape-html/1.0.3: - resolution: {integrity: sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=} - dev: false - - /etag/1.8.1: - resolution: {integrity: sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=} - engines: {node: '>= 0.6'} - dev: false - - /express/4.17.1: - resolution: {integrity: sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==} - engines: {node: '>= 0.10.0'} - dependencies: - accepts: 1.3.7 - array-flatten: 1.1.1 - body-parser: 1.19.0 - content-disposition: 0.5.3 - content-type: 1.0.4 - cookie: 0.4.0 - cookie-signature: 1.0.6 - debug: 2.6.9 - depd: 1.1.2 - encodeurl: 1.0.2 - escape-html: 1.0.3 - etag: 1.8.1 - finalhandler: 1.1.2 - fresh: 0.5.2 - merge-descriptors: 1.0.1 - methods: 1.1.2 - on-finished: 2.3.0 - parseurl: 1.3.3 - path-to-regexp: 0.1.7 - proxy-addr: 2.0.7 - qs: 6.7.0 - range-parser: 1.2.1 - safe-buffer: 5.1.2 - send: 0.17.1 - serve-static: 1.14.1 - setprototypeof: 1.1.1 - statuses: 1.5.0 - type-is: 1.6.18 - utils-merge: 1.0.1 - vary: 1.1.2 - dev: false - - /finalhandler/1.1.2: - resolution: {integrity: sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==} - engines: {node: '>= 0.8'} - dependencies: - debug: 2.6.9 - encodeurl: 1.0.2 - escape-html: 1.0.3 - on-finished: 2.3.0 - parseurl: 1.3.3 - statuses: 1.5.0 - unpipe: 1.0.0 - dev: false - - /forwarded/0.2.0: - resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} - engines: {node: '>= 0.6'} - dev: false - - /fresh/0.5.2: - resolution: {integrity: sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=} - engines: {node: '>= 0.6'} - dev: false - - /http-errors/1.7.2: - resolution: {integrity: sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==} - engines: {node: '>= 0.6'} - dependencies: - depd: 1.1.2 - inherits: 2.0.3 - setprototypeof: 1.1.1 - statuses: 1.5.0 - toidentifier: 1.0.0 - dev: false - - /http-errors/1.7.3: - resolution: {integrity: sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==} - engines: {node: '>= 0.6'} - dependencies: - depd: 1.1.2 - inherits: 2.0.4 - setprototypeof: 1.1.1 - statuses: 1.5.0 - toidentifier: 1.0.0 - dev: false - - /iconv-lite/0.4.24: - resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} - engines: {node: '>=0.10.0'} - dependencies: - safer-buffer: 2.1.2 - dev: false - - /inherits/2.0.3: - resolution: {integrity: sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=} - dev: false - - /inherits/2.0.4: - resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - dev: false - - /ipaddr.js/1.9.1: - resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} - engines: {node: '>= 0.10'} - dev: false - - /media-typer/0.3.0: - resolution: {integrity: sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=} - engines: {node: '>= 0.6'} - dev: false - - /merge-descriptors/1.0.1: - resolution: {integrity: sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=} - dev: false - - /methods/1.1.2: - resolution: {integrity: sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=} - engines: {node: '>= 0.6'} - dev: false - - /mime-db/1.48.0: - resolution: {integrity: sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==} - engines: {node: '>= 0.6'} - dev: false - - /mime-types/2.1.31: - resolution: {integrity: sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg==} - engines: {node: '>= 0.6'} - dependencies: - mime-db: 1.48.0 - dev: false - - /mime/1.6.0: - resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} - engines: {node: '>=4'} - hasBin: true - dev: false - - /ms/2.0.0: - resolution: {integrity: sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=} - dev: false - - /ms/2.1.1: - resolution: {integrity: sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==} - dev: false - - /negotiator/0.6.2: - resolution: {integrity: sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==} - engines: {node: '>= 0.6'} - dev: false - - /on-finished/2.3.0: - resolution: {integrity: sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=} - engines: {node: '>= 0.8'} - dependencies: - ee-first: 1.1.1 - dev: false - - /parseurl/1.3.3: - resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} - engines: {node: '>= 0.8'} - dev: false - - /path-to-regexp/0.1.7: - resolution: {integrity: sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=} - dev: false - - /proxy-addr/2.0.7: - resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} - engines: {node: '>= 0.10'} - dependencies: - forwarded: 0.2.0 - ipaddr.js: 1.9.1 - dev: false - - /qs/6.7.0: - resolution: {integrity: sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==} - engines: {node: '>=0.6'} - dev: false - - /range-parser/1.2.1: - resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} - engines: {node: '>= 0.6'} - dev: false - - /raw-body/2.4.0: - resolution: {integrity: sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==} - engines: {node: '>= 0.8'} - dependencies: - bytes: 3.1.0 - http-errors: 1.7.2 - iconv-lite: 0.4.24 - unpipe: 1.0.0 - dev: false - - /safe-buffer/5.1.2: - resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} - dev: false - - /safer-buffer/2.1.2: - resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - dev: false - - /send/0.17.1: - resolution: {integrity: sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==} - engines: {node: '>= 0.8.0'} - dependencies: - debug: 2.6.9 - depd: 1.1.2 - destroy: 1.0.4 - encodeurl: 1.0.2 - escape-html: 1.0.3 - etag: 1.8.1 - fresh: 0.5.2 - http-errors: 1.7.3 - mime: 1.6.0 - ms: 2.1.1 - on-finished: 2.3.0 - range-parser: 1.2.1 - statuses: 1.5.0 - dev: false - - /serve-static/1.14.1: - resolution: {integrity: sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==} - engines: {node: '>= 0.8.0'} - dependencies: - encodeurl: 1.0.2 - escape-html: 1.0.3 - parseurl: 1.3.3 - send: 0.17.1 - dev: false - - /setprototypeof/1.1.1: - resolution: {integrity: sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==} - dev: false - - /statuses/1.5.0: - resolution: {integrity: sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=} - engines: {node: '>= 0.6'} - dev: false - - /toidentifier/1.0.0: - resolution: {integrity: sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==} - engines: {node: '>=0.6'} - dev: false - - /type-is/1.6.18: - resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} - engines: {node: '>= 0.6'} - dependencies: - media-typer: 0.3.0 - mime-types: 2.1.31 - dev: false - - /unpipe/1.0.0: - resolution: {integrity: sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=} - engines: {node: '>= 0.8'} - dev: false - - /utils-merge/1.0.1: - resolution: {integrity: sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=} - engines: {node: '>= 0.4.0'} - dev: false - - /vary/1.1.2: - resolution: {integrity: sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=} - engines: {node: '>= 0.8'} - dev: false diff --git a/__tests__/data/versions-manifest.json b/__tests__/data/versions-manifest.json deleted file mode 100644 index 4cf2ccee..00000000 --- a/__tests__/data/versions-manifest.json +++ /dev/null @@ -1,157 +0,0 @@ -[ - { - "version": "14.0.0", - "stable": true, - "lts": "Fermium", - "release_url": "https://github.com/actions/node-versions/releases/tag/14.0.0-20200423.30", - "files": [ - { - "filename": "node-14.0.0-darwin-x64.tar.gz", - "arch": "x64", - "platform": "darwin", - "download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200423.30/node-14.0.0-darwin-x64.tar.gz" - }, - { - "filename": "node-14.0.0-linux-x64.tar.gz", - "arch": "x64", - "platform": "linux", - "download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200423.30/node-14.0.0-linux-x64.tar.gz" - }, - { - "filename": "node-14.0.0-win32-x64.zip", - "arch": "x64", - "platform": "win32", - "download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200423.30/node-14.0.0-win32-x64.zip" - } - ] - }, - { - "version": "13.13.0", - "stable": true, - "release_url": "https://github.com/actions/node-versions/releases/tag/13.13.0-20200423.29", - "files": [ - { - "filename": "node-13.13.0-darwin-x64.tar.gz", - "arch": "x64", - "platform": "darwin", - "download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200423.29/node-13.13.0-darwin-x64.tar.gz" - }, - { - "filename": "node-13.13.0-linux-x64.tar.gz", - "arch": "x64", - "platform": "linux", - "download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200423.29/node-13.13.0-linux-x64.tar.gz" - }, - { - "filename": "node-13.13.0-win32-x64.zip", - "arch": "x64", - "platform": "win32", - "download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200423.29/node-13.13.0-win32-x64.zip" - } - ] - }, - { - "version": "12.16.2", - "stable": true, - "lts": "Erbium", - "release_url": "https://github.com/actions/node-versions/releases/tag/12.16.2-20200423.28", - "files": [ - { - "filename": "node-12.16.2-darwin-x64.tar.gz", - "arch": "x64", - "platform": "darwin", - "download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-darwin-x64.tar.gz" - }, - { - "filename": "node-12.16.2-linux-x64.tar.gz", - "arch": "x64", - "platform": "linux", - "download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz" - }, - { - "filename": "node-12.16.2-win32-x64.zip", - "arch": "x64", - "platform": "win32", - "download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-win32-x64.zip" - } - ] - }, - { - "version": "10.20.1", - "stable": true, - "lts": "Dubnium", - "release_url": "https://github.com/actions/node-versions/releases/tag/10.20.1-20200423.27", - "files": [ - { - "filename": "node-10.20.1-darwin-x64.tar.gz", - "arch": "x64", - "platform": "darwin", - "download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200423.27/node-10.20.1-darwin-x64.tar.gz" - }, - { - "filename": "node-10.20.1-linux-x64.tar.gz", - "arch": "x64", - "platform": "linux", - "download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200423.27/node-10.20.1-linux-x64.tar.gz" - }, - { - "filename": "node-10.20.1-win32-x64.zip", - "arch": "x64", - "platform": "win32", - "download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200423.27/node-10.20.1-win32-x64.zip" - } - ] - }, - { - "version": "8.17.0", - "stable": true, - "lts": "Carbon", - "release_url": "https://github.com/actions/node-versions/releases/tag/8.17.0-20200423.26", - "files": [ - { - "filename": "node-8.17.0-darwin-x64.tar.gz", - "arch": "x64", - "platform": "darwin", - "download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200423.26/node-8.17.0-darwin-x64.tar.gz" - }, - { - "filename": "node-8.17.0-linux-x64.tar.gz", - "arch": "x64", - "platform": "linux", - "download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200423.26/node-8.17.0-linux-x64.tar.gz" - }, - { - "filename": "node-8.17.0-win32-x64.zip", - "arch": "x64", - "platform": "win32", - "download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200423.26/node-8.17.0-win32-x64.zip" - } - ] - }, - { - "version": "6.17.1", - "stable": true, - "lts": "Boron", - "release_url": "https://github.com/actions/node-versions/releases/tag/6.17.1-20200423.25", - "files": [ - { - "filename": "node-6.17.1-darwin-x64.tar.gz", - "arch": "x64", - "platform": "darwin", - "download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200423.25/node-6.17.1-darwin-x64.tar.gz" - }, - { - "filename": "node-6.17.1-linux-x64.tar.gz", - "arch": "x64", - "platform": "linux", - "download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200423.25/node-6.17.1-linux-x64.tar.gz" - }, - { - "filename": "node-6.17.1-win32-x64.zip", - "arch": "x64", - "platform": "win32", - "download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200423.25/node-6.17.1-win32-x64.zip" - } - ] - } - ] \ No newline at end of file diff --git a/__tests__/data/yarn.lock b/__tests__/data/yarn.lock deleted file mode 100644 index 97a144a7..00000000 --- a/__tests__/data/yarn.lock +++ /dev/null @@ -1,368 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -accepts@~1.3.7: - version "1.3.7" - resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" - integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== - dependencies: - mime-types "~2.1.24" - negotiator "0.6.2" - -array-flatten@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" - integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI= - -body-parser@1.19.0: - version "1.19.0" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" - integrity sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw== - dependencies: - bytes "3.1.0" - content-type "~1.0.4" - debug "2.6.9" - depd "~1.1.2" - http-errors "1.7.2" - iconv-lite "0.4.24" - on-finished "~2.3.0" - qs "6.7.0" - raw-body "2.4.0" - type-is "~1.6.17" - -bytes@3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" - integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== - -content-disposition@0.5.3: - version "0.5.3" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd" - integrity sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g== - dependencies: - safe-buffer "5.1.2" - -content-type@~1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" - integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== - -cookie-signature@1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" - integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= - -cookie@0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba" - integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg== - -debug@2.6.9: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - -depd@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" - integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= - -destroy@~1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" - integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA= - -ee-first@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" - integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= - -encodeurl@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" - integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= - -escape-html@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= - -etag@~1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" - integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= - -express@^4.17.1: - version "4.17.1" - resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134" - integrity sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g== - dependencies: - accepts "~1.3.7" - array-flatten "1.1.1" - body-parser "1.19.0" - content-disposition "0.5.3" - content-type "~1.0.4" - cookie "0.4.0" - cookie-signature "1.0.6" - debug "2.6.9" - depd "~1.1.2" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - finalhandler "~1.1.2" - fresh "0.5.2" - merge-descriptors "1.0.1" - methods "~1.1.2" - on-finished "~2.3.0" - parseurl "~1.3.3" - path-to-regexp "0.1.7" - proxy-addr "~2.0.5" - qs "6.7.0" - range-parser "~1.2.1" - safe-buffer "5.1.2" - send "0.17.1" - serve-static "1.14.1" - setprototypeof "1.1.1" - statuses "~1.5.0" - type-is "~1.6.18" - utils-merge "1.0.1" - vary "~1.1.2" - -finalhandler@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" - integrity sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA== - dependencies: - debug "2.6.9" - encodeurl "~1.0.2" - escape-html "~1.0.3" - on-finished "~2.3.0" - parseurl "~1.3.3" - statuses "~1.5.0" - unpipe "~1.0.0" - -forwarded@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" - integrity sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ= - -fresh@0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" - integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= - -http-errors@1.7.2: - version "1.7.2" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f" - integrity sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg== - dependencies: - depd "~1.1.2" - inherits "2.0.3" - setprototypeof "1.1.1" - statuses ">= 1.5.0 < 2" - toidentifier "1.0.0" - -http-errors@~1.7.2: - version "1.7.3" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.3.tgz#6c619e4f9c60308c38519498c14fbb10aacebb06" - integrity sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw== - dependencies: - depd "~1.1.2" - inherits "2.0.4" - setprototypeof "1.1.1" - statuses ">= 1.5.0 < 2" - toidentifier "1.0.0" - -iconv-lite@0.4.24: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== - dependencies: - safer-buffer ">= 2.1.2 < 3" - -inherits@2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= - -inherits@2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -ipaddr.js@1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" - integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== - -media-typer@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" - integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= - -merge-descriptors@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" - integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= - -methods@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= - -mime-db@1.47.0: - version "1.47.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.47.0.tgz#8cb313e59965d3c05cfbf898915a267af46a335c" - integrity sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw== - -mime-types@~2.1.24: - version "2.1.30" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.30.tgz#6e7be8b4c479825f85ed6326695db73f9305d62d" - integrity sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg== - dependencies: - mime-db "1.47.0" - -mime@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" - integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= - -ms@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" - integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== - -negotiator@0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" - integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== - -on-finished@~2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" - integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc= - dependencies: - ee-first "1.1.1" - -parseurl@~1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" - integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== - -path-to-regexp@0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" - integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= - -proxy-addr@~2.0.5: - version "2.0.6" - resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.6.tgz#fdc2336505447d3f2f2c638ed272caf614bbb2bf" - integrity sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw== - dependencies: - forwarded "~0.1.2" - ipaddr.js "1.9.1" - -qs@6.7.0: - version "6.7.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" - integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== - -range-parser@~1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== - -raw-body@2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332" - integrity sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q== - dependencies: - bytes "3.1.0" - http-errors "1.7.2" - iconv-lite "0.4.24" - unpipe "1.0.0" - -safe-buffer@5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - -"safer-buffer@>= 2.1.2 < 3": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -send@0.17.1: - version "0.17.1" - resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" - integrity sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg== - dependencies: - debug "2.6.9" - depd "~1.1.2" - destroy "~1.0.4" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - fresh "0.5.2" - http-errors "~1.7.2" - mime "1.6.0" - ms "2.1.1" - on-finished "~2.3.0" - range-parser "~1.2.1" - statuses "~1.5.0" - -serve-static@1.14.1: - version "1.14.1" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9" - integrity sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg== - dependencies: - encodeurl "~1.0.2" - escape-html "~1.0.3" - parseurl "~1.3.3" - send "0.17.1" - -setprototypeof@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" - integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== - -"statuses@>= 1.5.0 < 2", statuses@~1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" - integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= - -toidentifier@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" - integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== - -type-is@~1.6.17, type-is@~1.6.18: - version "1.6.18" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" - integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== - dependencies: - media-typer "0.3.0" - mime-types "~2.1.24" - -unpipe@1.0.0, unpipe@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" - integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= - -utils-merge@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" - integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= - -vary@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts deleted file mode 100644 index 4565dd4c..00000000 --- a/__tests__/installer.test.ts +++ /dev/null @@ -1,864 +0,0 @@ -import * as core from '@actions/core'; -import * as io from '@actions/io'; -import * as tc from '@actions/tool-cache'; -import * as im from '../src/installer'; -import fs from 'fs'; -import cp from 'child_process'; -import osm = require('os'); -import path from 'path'; -import * as main from '../src/main'; -import * as auth from '../src/authutil'; - -let nodeTestManifest = require('./data/versions-manifest.json'); -let nodeTestDist = require('./data/node-dist-index.json'); - -describe('setup-node', () => { - let inputs = {} as any; - let os = {} as any; - - let inSpy: jest.SpyInstance; - let findSpy: jest.SpyInstance; - let cnSpy: jest.SpyInstance; - let logSpy: jest.SpyInstance; - let warningSpy: jest.SpyInstance; - let getManifestSpy: jest.SpyInstance; - let getDistSpy: jest.SpyInstance; - let platSpy: jest.SpyInstance; - let archSpy: jest.SpyInstance; - let dlSpy: jest.SpyInstance; - let exSpy: jest.SpyInstance; - let cacheSpy: jest.SpyInstance; - let dbgSpy: jest.SpyInstance; - let whichSpy: jest.SpyInstance; - let existsSpy: jest.SpyInstance; - let readFileSyncSpy: jest.SpyInstance; - let mkdirpSpy: jest.SpyInstance; - let execSpy: jest.SpyInstance; - let authSpy: jest.SpyInstance; - let parseNodeVersionSpy: jest.SpyInstance; - - beforeEach(() => { - // @actions/core - console.log('::stop-commands::stoptoken'); // Disable executing of runner commands when running tests in actions - process.env['GITHUB_PATH'] = ''; // Stub out ENV file functionality so we can verify it writes to standard out - inputs = {}; - inSpy = jest.spyOn(core, 'getInput'); - inSpy.mockImplementation(name => inputs[name]); - - // node - os = {}; - platSpy = jest.spyOn(osm, 'platform'); - platSpy.mockImplementation(() => os['platform']); - archSpy = jest.spyOn(osm, 'arch'); - archSpy.mockImplementation(() => os['arch']); - execSpy = jest.spyOn(cp, 'execSync'); - - // @actions/tool-cache - findSpy = jest.spyOn(tc, 'find'); - dlSpy = jest.spyOn(tc, 'downloadTool'); - exSpy = jest.spyOn(tc, 'extractTar'); - cacheSpy = jest.spyOn(tc, 'cacheDir'); - getManifestSpy = jest.spyOn(tc, 'getManifestFromRepo'); - getDistSpy = jest.spyOn(im, 'getVersionsFromDist'); - parseNodeVersionSpy = jest.spyOn(im, 'parseNodeVersionFile'); - - // io - whichSpy = jest.spyOn(io, 'which'); - existsSpy = jest.spyOn(fs, 'existsSync'); - mkdirpSpy = jest.spyOn(io, 'mkdirP'); - - // disable authentication portion for installer tests - authSpy = jest.spyOn(auth, 'configAuthentication'); - authSpy.mockImplementation(() => {}); - - // gets - getManifestSpy.mockImplementation( - () => nodeTestManifest - ); - getDistSpy.mockImplementation(() => nodeTestDist); - - // writes - cnSpy = jest.spyOn(process.stdout, 'write'); - logSpy = jest.spyOn(core, 'info'); - dbgSpy = jest.spyOn(core, 'debug'); - warningSpy = jest.spyOn(core, 'warning'); - cnSpy.mockImplementation(line => { - // uncomment to debug - // process.stderr.write('write:' + line + '\n'); - }); - logSpy.mockImplementation(line => { - // uncomment to debug - // process.stderr.write('log:' + line + '\n'); - }); - dbgSpy.mockImplementation(msg => { - // uncomment to see debug output - // process.stderr.write(msg + '\n'); - }); - warningSpy.mockImplementation(msg => { - // uncomment to debug - // process.stderr.write('log:' + line + '\n'); - }); - }); - - afterEach(() => { - jest.resetAllMocks(); - jest.clearAllMocks(); - //jest.restoreAllMocks(); - }); - - afterAll(async () => { - console.log('::stoptoken::'); // Re-enable executing of runner commands when running tests in actions - jest.restoreAllMocks(); - }, 100000); - - //-------------------------------------------------- - // Manifest find tests - //-------------------------------------------------- - it('can mock manifest versions', async () => { - let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo( - 'actions', - 'node-versions', - 'mocktoken' - ); - expect(versions).toBeDefined(); - expect(versions?.length).toBe(6); - }); - - it('can mock dist versions', async () => { - let versions: im.INodeVersion[] = await im.getVersionsFromDist(); - expect(versions).toBeDefined(); - expect(versions?.length).toBe(23); - }); - - it('can find 12.16.2 from manifest on osx', async () => { - os.platform = 'darwin'; - os.arch = 'x64'; - let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo( - 'actions', - 'node-versions', - 'mocktoken' - ); - expect(versions).toBeDefined(); - let match = await tc.findFromManifest('12.16.2', true, versions); - expect(match).toBeDefined(); - expect(match?.version).toBe('12.16.2'); - expect((match as any).lts).toBe('Erbium'); - }); - - it('can find 12 from manifest on linux', async () => { - os.platform = 'linux'; - os.arch = 'x64'; - let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo( - 'actions', - 'node-versions', - 'mocktoken' - ); - expect(versions).toBeDefined(); - let match = await tc.findFromManifest('12.16.2', true, versions); - expect(match).toBeDefined(); - expect(match?.version).toBe('12.16.2'); - expect((match as any).lts).toBe('Erbium'); - }); - - it('can find 10 from manifest on windows', async () => { - os.platform = 'win32'; - os.arch = 'x64'; - let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo( - 'actions', - 'node-versions', - 'mocktoken' - ); - expect(versions).toBeDefined(); - let match = await tc.findFromManifest('10', true, versions); - expect(match).toBeDefined(); - expect(match?.version).toBe('10.20.1'); - expect((match as any).lts).toBe('Dubnium'); - }); - - //-------------------------------------------------- - // Found in cache tests - //-------------------------------------------------- - - it('finds version in cache with stable true', async () => { - inputs['node-version'] = '12'; - inputs.stable = 'true'; - - let toolPath = path.normalize('/cache/node/12.16.1/x64'); - findSpy.mockImplementation(() => toolPath); - await main.run(); - - expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); - }); - - it('finds version in cache with stable not supplied', async () => { - inputs['node-version'] = '12'; - - inSpy.mockImplementation(name => inputs[name]); - - let toolPath = path.normalize('/cache/node/12.16.1/x64'); - findSpy.mockImplementation(() => toolPath); - await main.run(); - - expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); - }); - - it('finds version in cache and adds it to the path', async () => { - inputs['node-version'] = '12'; - - inSpy.mockImplementation(name => inputs[name]); - - let toolPath = path.normalize('/cache/node/12.16.1/x64'); - findSpy.mockImplementation(() => toolPath); - await main.run(); - - let expPath = path.join(toolPath, 'bin'); - expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); - }); - - it('handles unhandled find error and reports error', async () => { - let errMsg = 'unhandled error message'; - inputs['node-version'] = '12'; - - findSpy.mockImplementation(() => { - throw new Error(errMsg); - }); - - await main.run(); - - expect(cnSpy).toHaveBeenCalledWith('::error::' + errMsg + osm.EOL); - }); - - //-------------------------------------------------- - // Manifest tests - //-------------------------------------------------- - - it('downloads a version from a manifest match', async () => { - os.platform = 'linux'; - os.arch = 'x64'; - - // a version which is in the manifest - let versionSpec = '12.16.2'; - let resolvedVersion = versionSpec; - - inputs['node-version'] = versionSpec; - inputs['always-auth'] = false; - inputs['token'] = 'faketoken'; - - let expectedUrl = - 'https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz'; - - // ... but not in the local cache - findSpy.mockImplementation(() => ''); - - dlSpy.mockImplementation(async () => '/some/temp/path'); - let toolPath = path.normalize('/cache/node/12.16.2/x64'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); - cacheSpy.mockImplementation(async () => toolPath); - - await main.run(); - - let expPath = path.join(toolPath, 'bin'); - - expect(dlSpy).toHaveBeenCalled(); - expect(exSpy).toHaveBeenCalled(); - expect(logSpy).toHaveBeenCalledWith( - `Acquiring ${resolvedVersion} - ${os.arch} from ${expectedUrl}` - ); - expect(logSpy).toHaveBeenCalledWith( - `Attempting to download ${versionSpec}...` - ); - expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); - }); - - it('falls back to a version from node dist', async () => { - os.platform = 'linux'; - os.arch = 'x64'; - - // a version which is not in the manifest but is in node dist - let versionSpec = '11.15.0'; - let resolvedVersion = versionSpec; - - inputs['node-version'] = versionSpec; - inputs['always-auth'] = false; - inputs['token'] = 'faketoken'; - - let expectedUrl = - 'https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz'; - - // ... but not in the local cache - findSpy.mockImplementation(() => ''); - - dlSpy.mockImplementation(async () => '/some/temp/path'); - let toolPath = path.normalize('/cache/node/11.11.0/x64'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); - cacheSpy.mockImplementation(async () => toolPath); - - await main.run(); - - let expPath = path.join(toolPath, 'bin'); - - expect(dlSpy).toHaveBeenCalled(); - expect(exSpy).toHaveBeenCalled(); - expect(logSpy).toHaveBeenCalledWith( - 'Not found in manifest. Falling back to download directly from Node' - ); - expect(logSpy).toHaveBeenCalledWith( - `Attempting to download ${versionSpec}...` - ); - expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); - }); - - it('does not find a version that does not exist', async () => { - os.platform = 'linux'; - os.arch = 'x64'; - - let versionSpec = '9.99.9'; - inputs['node-version'] = versionSpec; - - findSpy.mockImplementation(() => ''); - await main.run(); - - expect(logSpy).toHaveBeenCalledWith( - 'Not found in manifest. Falling back to download directly from Node' - ); - expect(logSpy).toHaveBeenCalledWith( - `Attempting to download ${versionSpec}...` - ); - expect(cnSpy).toHaveBeenCalledWith( - `::error::Unable to find Node version '${versionSpec}' for platform ${os.platform} and architecture ${os.arch}.${osm.EOL}` - ); - }); - - it('reports a failed download', async () => { - let errMsg = 'unhandled download message'; - os.platform = 'linux'; - os.arch = 'x64'; - - // a version which is in the manifest - let versionSpec = '12.16.2'; - let resolvedVersion = versionSpec; - - inputs['node-version'] = versionSpec; - inputs['always-auth'] = false; - inputs['token'] = 'faketoken'; - - findSpy.mockImplementation(() => ''); - dlSpy.mockImplementation(() => { - throw new Error(errMsg); - }); - await main.run(); - - expect(cnSpy).toHaveBeenCalledWith(`::error::${errMsg}${osm.EOL}`); - }); - - it('acquires specified architecture of node', async () => { - for (const {arch, version, osSpec} of [ - {arch: 'x86', version: '12.16.2', osSpec: 'win32'}, - {arch: 'x86', version: '14.0.0', osSpec: 'win32'} - ]) { - os.platform = osSpec; - os.arch = arch; - const fileExtension = os.platform === 'win32' ? '7z' : 'tar.gz'; - const platform = { - linux: 'linux', - darwin: 'darwin', - win32: 'win' - }[os.platform]; - - inputs['node-version'] = version; - inputs['architecture'] = arch; - inputs['always-auth'] = false; - inputs['token'] = 'faketoken'; - - let expectedUrl = - arch === 'x64' - ? `https://github.com/actions/node-versions/releases/download/${version}/node-${version}-${platform}-${arch}.zip` - : `https://nodejs.org/dist/v${version}/node-v${version}-${platform}-${arch}.${fileExtension}`; - - // ... but not in the local cache - findSpy.mockImplementation(() => ''); - - dlSpy.mockImplementation(async () => '/some/temp/path'); - let toolPath = path.normalize(`/cache/node/${version}/${arch}`); - exSpy.mockImplementation(async () => '/some/other/temp/path'); - cacheSpy.mockImplementation(async () => toolPath); - - await main.run(); - expect(dlSpy).toHaveBeenCalled(); - expect(logSpy).toHaveBeenCalledWith( - `Acquiring ${version} - ${arch} from ${expectedUrl}` - ); - } - }, 100000); - - describe('check-latest flag', () => { - it('use local version and dont check manifest if check-latest is not specified', async () => { - os.platform = 'linux'; - os.arch = 'x64'; - - inputs['node-version'] = '12'; - inputs['check-latest'] = 'false'; - - const toolPath = path.normalize('/cache/node/12.16.1/x64'); - findSpy.mockReturnValue(toolPath); - await main.run(); - - expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); - expect(logSpy).not.toHaveBeenCalledWith( - 'Attempt to resolve the latest version from manifest...' - ); - expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached'); - expect(dbgSpy).not.toHaveBeenCalledWith( - 'Getting manifest from actions/node-versions@main' - ); - }); - - it('check latest version and resolve it from local cache', async () => { - os.platform = 'linux'; - os.arch = 'x64'; - - inputs['node-version'] = '12'; - inputs['check-latest'] = 'true'; - - const toolPath = path.normalize('/cache/node/12.16.2/x64'); - findSpy.mockReturnValue(toolPath); - dlSpy.mockImplementation(async () => '/some/temp/path'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); - cacheSpy.mockImplementation(async () => toolPath); - - await main.run(); - - expect(logSpy).toHaveBeenCalledWith( - 'Attempt to resolve the latest version from manifest...' - ); - expect(dbgSpy).toHaveBeenCalledWith('No manifest cached'); - expect(dbgSpy).toHaveBeenCalledWith( - 'Getting manifest from actions/node-versions@main' - ); - expect(logSpy).toHaveBeenCalledWith("Resolved as '12.16.2'"); - expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); - }); - - it('check latest version and install it from manifest', async () => { - os.platform = 'linux'; - os.arch = 'x64'; - - inputs['node-version'] = '12'; - inputs['check-latest'] = 'true'; - - findSpy.mockImplementation(() => ''); - dlSpy.mockImplementation(async () => '/some/temp/path'); - const toolPath = path.normalize('/cache/node/12.16.2/x64'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); - cacheSpy.mockImplementation(async () => toolPath); - const expectedUrl = - 'https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz'; - - await main.run(); - - expect(logSpy).toHaveBeenCalledWith( - 'Attempt to resolve the latest version from manifest...' - ); - expect(dbgSpy).toHaveBeenCalledWith('No manifest cached'); - expect(dbgSpy).toHaveBeenCalledWith( - 'Getting manifest from actions/node-versions@main' - ); - expect(logSpy).toHaveBeenCalledWith("Resolved as '12.16.2'"); - expect(logSpy).toHaveBeenCalledWith( - `Acquiring 12.16.2 - ${os.arch} from ${expectedUrl}` - ); - expect(logSpy).toHaveBeenCalledWith('Extracting ...'); - }); - - it('fallback to dist if version if not found in manifest', async () => { - os.platform = 'linux'; - os.arch = 'x64'; - - // a version which is not in the manifest but is in node dist - let versionSpec = '11'; - - inputs['node-version'] = versionSpec; - inputs['check-latest'] = 'true'; - inputs['always-auth'] = false; - inputs['token'] = 'faketoken'; - - // ... but not in the local cache - findSpy.mockImplementation(() => ''); - - dlSpy.mockImplementation(async () => '/some/temp/path'); - let toolPath = path.normalize('/cache/node/11.11.0/x64'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); - cacheSpy.mockImplementation(async () => toolPath); - - await main.run(); - - let expPath = path.join(toolPath, 'bin'); - - expect(dlSpy).toHaveBeenCalled(); - expect(exSpy).toHaveBeenCalled(); - expect(logSpy).toHaveBeenCalledWith( - 'Attempt to resolve the latest version from manifest...' - ); - expect(dbgSpy).toHaveBeenCalledWith('No manifest cached'); - expect(dbgSpy).toHaveBeenCalledWith( - 'Getting manifest from actions/node-versions@main' - ); - expect(logSpy).toHaveBeenCalledWith( - `Failed to resolve version ${versionSpec} from manifest` - ); - expect(logSpy).toHaveBeenCalledWith( - `Attempting to download ${versionSpec}...` - ); - expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); - }); - - it('fallback to dist if manifest is not available', async () => { - os.platform = 'linux'; - os.arch = 'x64'; - - // a version which is not in the manifest but is in node dist - let versionSpec = '12'; - - inputs['node-version'] = versionSpec; - inputs['check-latest'] = 'true'; - inputs['always-auth'] = false; - inputs['token'] = 'faketoken'; - - // ... but not in the local cache - findSpy.mockImplementation(() => ''); - getManifestSpy.mockImplementation(() => { - throw new Error('Unable to download manifest'); - }); - - dlSpy.mockImplementation(async () => '/some/temp/path'); - let toolPath = path.normalize('/cache/node/12.11.0/x64'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); - cacheSpy.mockImplementation(async () => toolPath); - - await main.run(); - - let expPath = path.join(toolPath, 'bin'); - - expect(dlSpy).toHaveBeenCalled(); - expect(exSpy).toHaveBeenCalled(); - expect(logSpy).toHaveBeenCalledWith( - 'Attempt to resolve the latest version from manifest...' - ); - expect(logSpy).toHaveBeenCalledWith( - 'Unable to resolve version from manifest...' - ); - expect(logSpy).toHaveBeenCalledWith( - `Failed to resolve version ${versionSpec} from manifest` - ); - expect(logSpy).toHaveBeenCalledWith( - `Attempting to download ${versionSpec}...` - ); - expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); - }); - }); - - describe('node-version-file flag', () => { - it('not used if node-version is provided', async () => { - // Arrange - inputs['node-version'] = '12'; - - // Act - await main.run(); - - // Assert - expect(parseNodeVersionSpy).toHaveBeenCalledTimes(0); - }); - - it('not used if node-version-file not provided', async () => { - // Act - await main.run(); - - // Assert - expect(parseNodeVersionSpy).toHaveBeenCalledTimes(0); - }); - - it('reads node-version-file if provided', async () => { - // Arrange - const versionSpec = 'v14'; - const versionFile = '.nvmrc'; - const expectedVersionSpec = '14'; - process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data'); - inputs['node-version-file'] = versionFile; - - parseNodeVersionSpy.mockImplementation(() => expectedVersionSpec); - existsSpy.mockImplementationOnce( - input => input === path.join(__dirname, 'data', versionFile) - ); - // Act - await main.run(); - - // Assert - expect(existsSpy).toHaveBeenCalledTimes(1); - expect(existsSpy).toHaveReturnedWith(true); - expect(parseNodeVersionSpy).toHaveBeenCalledWith(versionSpec); - expect(logSpy).toHaveBeenCalledWith( - `Resolved ${versionFile} as ${expectedVersionSpec}` - ); - }); - - it('both node-version-file and node-version are provided', async () => { - inputs['node-version'] = '12'; - const versionSpec = 'v14'; - const versionFile = '.nvmrc'; - const expectedVersionSpec = '14'; - process.env['GITHUB_WORKSPACE'] = path.join(__dirname, '..'); - inputs['node-version-file'] = versionFile; - - parseNodeVersionSpy.mockImplementation(() => expectedVersionSpec); - - // Act - await main.run(); - - // Assert - expect(existsSpy).toHaveBeenCalledTimes(0); - expect(parseNodeVersionSpy).not.toHaveBeenCalled(); - expect(warningSpy).toHaveBeenCalledWith( - 'Both node-version and node-version-file inputs are specified, only node-version will be used' - ); - }); - - it('should throw an error if node-version-file is not found', async () => { - const versionFile = '.nvmrc'; - const versionFilePath = path.join(__dirname, '..', versionFile); - inputs['node-version-file'] = versionFile; - - inSpy.mockImplementation(name => inputs[name]); - existsSpy.mockImplementationOnce( - input => input === path.join(__dirname, 'data', versionFile) - ); - - // Act - await main.run(); - - // Assert - expect(existsSpy).toHaveBeenCalled(); - expect(existsSpy).toHaveReturnedWith(false); - expect(parseNodeVersionSpy).not.toHaveBeenCalled(); - expect(cnSpy).toHaveBeenCalledWith( - `::error::The specified node version file at: ${versionFilePath} does not exist${osm.EOL}` - ); - }); - }); - describe('LTS version', () => { - beforeEach(() => { - os.platform = 'linux'; - os.arch = 'x64'; - inputs.stable = 'true'; - }); - - it('find latest LTS version and resolve it from local cache (lts/erbium)', async () => { - // arrange - inputs['node-version'] = 'lts/erbium'; - - const toolPath = path.normalize('/cache/node/12.16.2/x64'); - findSpy.mockReturnValue(toolPath); - - // act - await main.run(); - - // assert - expect(logSpy).toHaveBeenCalledWith( - 'Attempt to resolve LTS alias from manifest...' - ); - expect(dbgSpy).toHaveBeenCalledWith( - 'Getting manifest from actions/node-versions@main' - ); - expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached'); - expect(dbgSpy).toHaveBeenCalledWith( - `LTS alias 'erbium' for Node version 'lts/erbium'` - ); - expect(dbgSpy).toHaveBeenCalledWith( - `Found LTS release '12.16.2' for Node version 'lts/erbium'` - ); - expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); - expect(cnSpy).toHaveBeenCalledWith( - `::add-path::${path.join(toolPath, 'bin')}${osm.EOL}` - ); - }); - - it('find latest LTS version and install it from manifest (lts/erbium)', async () => { - // arrange - inputs['node-version'] = 'lts/erbium'; - - const toolPath = path.normalize('/cache/node/12.16.2/x64'); - findSpy.mockImplementation(() => ''); - dlSpy.mockImplementation(async () => '/some/temp/path'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); - cacheSpy.mockImplementation(async () => toolPath); - const expectedUrl = - 'https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz'; - - // act - await main.run(); - - // assert - expect(logSpy).toHaveBeenCalledWith( - 'Attempt to resolve LTS alias from manifest...' - ); - expect(dbgSpy).toHaveBeenCalledWith( - 'Getting manifest from actions/node-versions@main' - ); - expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached'); - expect(dbgSpy).toHaveBeenCalledWith( - `LTS alias 'erbium' for Node version 'lts/erbium'` - ); - expect(dbgSpy).toHaveBeenCalledWith( - `Found LTS release '12.16.2' for Node version 'lts/erbium'` - ); - expect(logSpy).toHaveBeenCalledWith('Attempting to download 12...'); - expect(logSpy).toHaveBeenCalledWith( - `Acquiring 12.16.2 - ${os.arch} from ${expectedUrl}` - ); - expect(logSpy).toHaveBeenCalledWith('Extracting ...'); - expect(logSpy).toHaveBeenCalledWith('Adding to the cache ...'); - expect(cnSpy).toHaveBeenCalledWith( - `::add-path::${path.join(toolPath, 'bin')}${osm.EOL}` - ); - }); - - it('find latest LTS version and resolve it from local cache (lts/*)', async () => { - // arrange - inputs['node-version'] = 'lts/*'; - - const toolPath = path.normalize('/cache/node/14.0.0/x64'); - findSpy.mockReturnValue(toolPath); - - // act - await main.run(); - - // assert - expect(logSpy).toHaveBeenCalledWith( - 'Attempt to resolve LTS alias from manifest...' - ); - expect(dbgSpy).toHaveBeenCalledWith( - 'Getting manifest from actions/node-versions@main' - ); - expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached'); - expect(dbgSpy).toHaveBeenCalledWith( - `LTS alias '*' for Node version 'lts/*'` - ); - expect(dbgSpy).toHaveBeenCalledWith( - `Found LTS release '14.0.0' for Node version 'lts/*'` - ); - expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); - expect(cnSpy).toHaveBeenCalledWith( - `::add-path::${path.join(toolPath, 'bin')}${osm.EOL}` - ); - }); - - it('find latest LTS version and install it from manifest (lts/*)', async () => { - // arrange - inputs['node-version'] = 'lts/*'; - - const toolPath = path.normalize('/cache/node/14.0.0/x64'); - findSpy.mockImplementation(() => ''); - dlSpy.mockImplementation(async () => '/some/temp/path'); - exSpy.mockImplementation(async () => '/some/other/temp/path'); - cacheSpy.mockImplementation(async () => toolPath); - const expectedUrl = - 'https://github.com/actions/node-versions/releases/download/14.0.0-20200423.30/node-14.0.0-linux-x64.tar.gz'; - - // act - await main.run(); - - // assert - expect(logSpy).toHaveBeenCalledWith( - 'Attempt to resolve LTS alias from manifest...' - ); - expect(dbgSpy).toHaveBeenCalledWith( - 'Getting manifest from actions/node-versions@main' - ); - expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached'); - expect(dbgSpy).toHaveBeenCalledWith( - `LTS alias '*' for Node version 'lts/*'` - ); - expect(dbgSpy).toHaveBeenCalledWith( - `Found LTS release '14.0.0' for Node version 'lts/*'` - ); - expect(logSpy).toHaveBeenCalledWith('Attempting to download 14...'); - expect(logSpy).toHaveBeenCalledWith( - `Acquiring 14.0.0 - ${os.arch} from ${expectedUrl}` - ); - expect(logSpy).toHaveBeenCalledWith('Extracting ...'); - expect(logSpy).toHaveBeenCalledWith('Adding to the cache ...'); - expect(cnSpy).toHaveBeenCalledWith( - `::add-path::${path.join(toolPath, 'bin')}${osm.EOL}` - ); - }); - - it('fail with unable to parse LTS alias (lts/)', async () => { - // arrange - inputs['node-version'] = 'lts/'; - - findSpy.mockImplementation(() => ''); - - // act - await main.run(); - - // assert - expect(logSpy).toHaveBeenCalledWith( - 'Attempt to resolve LTS alias from manifest...' - ); - expect(dbgSpy).toHaveBeenCalledWith( - 'Getting manifest from actions/node-versions@main' - ); - expect(cnSpy).toHaveBeenCalledWith( - `::error::Unable to parse LTS alias for Node version 'lts/'${osm.EOL}` - ); - }); - - it('fail to find LTS version (lts/unknown)', async () => { - // arrange - inputs['node-version'] = 'lts/unknown'; - - findSpy.mockImplementation(() => ''); - - // act - await main.run(); - - // assert - expect(logSpy).toHaveBeenCalledWith( - 'Attempt to resolve LTS alias from manifest...' - ); - expect(dbgSpy).toHaveBeenCalledWith( - 'Getting manifest from actions/node-versions@main' - ); - expect(dbgSpy).toHaveBeenCalledWith( - `LTS alias 'unknown' for Node version 'lts/unknown'` - ); - expect(cnSpy).toHaveBeenCalledWith( - `::error::Unable to find LTS release 'unknown' for Node version 'lts/unknown'.${osm.EOL}` - ); - }); - - it('fail if manifest is not available', async () => { - // arrange - inputs['node-version'] = 'lts/erbium'; - - // ... but not in the local cache - findSpy.mockImplementation(() => ''); - getManifestSpy.mockImplementation(() => { - throw new Error('Unable to download manifest'); - }); - - // act - await main.run(); - - // assert - expect(logSpy).toHaveBeenCalledWith( - 'Attempt to resolve LTS alias from manifest...' - ); - expect(dbgSpy).toHaveBeenCalledWith( - 'Getting manifest from actions/node-versions@main' - ); - expect(cnSpy).toHaveBeenCalledWith( - `::error::Unable to download manifest${osm.EOL}` - ); - }); - }); -}); diff --git a/__tests__/problem-matcher.test.ts b/__tests__/problem-matcher.test.ts deleted file mode 100644 index 4bcfdd1b..00000000 --- a/__tests__/problem-matcher.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -describe('problem matcher tests', () => { - it('tsc: matches TypeScript "pretty" error message', () => { - const [ - { - pattern: [{regexp}] - } - ] = require('../.github/tsc.json').problemMatcher; - const exampleErrorMessage = - "lib/index.js:23:42 - error TS2345: Argument of type 'A' is not assignable to parameter of type 'B'."; - - const match = exampleErrorMessage.match(new RegExp(regexp)); - expect(match).not.toBeNull(); - expect(match![1]).toEqual('lib/index.js'); - expect(match![2]).toEqual('23'); - expect(match![3]).toEqual('42'); - expect(match![4]).toEqual('error'); - expect(match![5]).toEqual('2345'); - expect(match![6]).toEqual( - "Argument of type 'A' is not assignable to parameter of type 'B'." - ); - }); - - it('tsc: matches TypeScript error message from log file', () => { - const [ - { - pattern: [{regexp}] - } - ] = require('../.github/tsc.json').problemMatcher; - const exampleErrorMessage = - "lib/index.js(23,42): error TS2345: Argument of type 'A' is not assignable to parameter of type 'B'."; - - const match = exampleErrorMessage.match(new RegExp(regexp)); - expect(match).not.toBeNull(); - expect(match![1]).toEqual('lib/index.js'); - expect(match![2]).toEqual('23'); - expect(match![3]).toEqual('42'); - expect(match![4]).toEqual('error'); - expect(match![5]).toEqual('2345'); - expect(match![6]).toEqual( - "Argument of type 'A' is not assignable to parameter of type 'B'." - ); - }); -}); diff --git a/__tests__/verify-arch.sh b/__tests__/verify-arch.sh deleted file mode 100644 index 7d4ebcbb..00000000 --- a/__tests__/verify-arch.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -if [ -n "$1" ]; then - architecture="$(node -e 'console.log(process.arch)')" - if [ -z "$(echo $architecture | grep --fixed-strings $1)" ]; then - echo "Unexpected architecture" - exit 1 - fi -else - echo "Skip testing architecture" -fi \ No newline at end of file diff --git a/__tests__/verify-node.sh b/__tests__/verify-node.sh deleted file mode 100755 index 797aa789..00000000 --- a/__tests__/verify-node.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -if [ -z "$1" ]; then - echo "Must supply node version argument" - exit 1 -fi - -node_version="$(node --version)" -echo "Found node version '$node_version'" -if [ -z "$(echo $node_version | grep --fixed-strings v$1)" ]; then - echo "Unexpected version" - exit 1 -fi - -if [ -z "$2" ]; then - echo "Testing npm install" - mkdir -p test-npm-install - cd test-npm-install - npm init -y || exit 1 - npm install @actions/core || exit 1 -else - echo "Skip testing npm" -fi