|
|
|
@@ -226,11 +226,10 @@ describe('setup-node', () => {
|
|
|
|
// Manifest tests
|
|
|
|
// Manifest tests
|
|
|
|
//--------------------------------------------------
|
|
|
|
//--------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
it('downloads a version from a manifest match', async () => {
|
|
|
|
it('downloads a version from node dist', async () => {
|
|
|
|
os.platform = 'linux';
|
|
|
|
os.platform = 'linux';
|
|
|
|
os.arch = 'x64';
|
|
|
|
os.arch = 'x64';
|
|
|
|
|
|
|
|
|
|
|
|
// a version which is in the manifest
|
|
|
|
|
|
|
|
const versionSpec = '12.16.2';
|
|
|
|
const versionSpec = '12.16.2';
|
|
|
|
const resolvedVersion = versionSpec;
|
|
|
|
const resolvedVersion = versionSpec;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -238,9 +237,6 @@ describe('setup-node', () => {
|
|
|
|
inputs['always-auth'] = false;
|
|
|
|
inputs['always-auth'] = false;
|
|
|
|
inputs['token'] = 'faketoken';
|
|
|
|
inputs['token'] = 'faketoken';
|
|
|
|
|
|
|
|
|
|
|
|
const expectedUrl =
|
|
|
|
|
|
|
|
'https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-linux-x64.tar.gz';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ... but not in the local cache
|
|
|
|
// ... but not in the local cache
|
|
|
|
findSpy.mockImplementation(() => '');
|
|
|
|
findSpy.mockImplementation(() => '');
|
|
|
|
|
|
|
|
|
|
|
|
@@ -256,6 +252,7 @@ describe('setup-node', () => {
|
|
|
|
|
|
|
|
|
|
|
|
const expPath = path.join(toolPath, 'bin');
|
|
|
|
const expPath = path.join(toolPath, 'bin');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(getManifestSpy).not.toHaveBeenCalled();
|
|
|
|
expect(getExecOutputSpy).toHaveBeenCalledWith(
|
|
|
|
expect(getExecOutputSpy).toHaveBeenCalledWith(
|
|
|
|
'node',
|
|
|
|
'node',
|
|
|
|
['--version'],
|
|
|
|
['--version'],
|
|
|
|
@@ -274,7 +271,7 @@ describe('setup-node', () => {
|
|
|
|
expect(dlSpy).toHaveBeenCalled();
|
|
|
|
expect(dlSpy).toHaveBeenCalled();
|
|
|
|
expect(exSpy).toHaveBeenCalled();
|
|
|
|
expect(exSpy).toHaveBeenCalled();
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
`Acquiring ${resolvedVersion} - ${os.arch} from ${expectedUrl}`
|
|
|
|
`Not found in manifest. Falling back to download directly from Node`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
`Attempting to download ${versionSpec}...`
|
|
|
|
`Attempting to download ${versionSpec}...`
|
|
|
|
@@ -307,7 +304,8 @@ describe('setup-node', () => {
|
|
|
|
|
|
|
|
|
|
|
|
const expPath = path.join(toolPath, 'bin');
|
|
|
|
const expPath = path.join(toolPath, 'bin');
|
|
|
|
|
|
|
|
|
|
|
|
expect(getManifestSpy).toHaveBeenCalled();
|
|
|
|
// When mirror is set, manifest is skipped — getManifestFromRepo is never called
|
|
|
|
|
|
|
|
expect(getManifestSpy).not.toHaveBeenCalled();
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
`Attempting to download ${versionSpec}...`
|
|
|
|
`Attempting to download ${versionSpec}...`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@@ -342,7 +340,7 @@ describe('setup-node', () => {
|
|
|
|
|
|
|
|
|
|
|
|
const expPath = path.join(toolPath, 'bin');
|
|
|
|
const expPath = path.join(toolPath, 'bin');
|
|
|
|
|
|
|
|
|
|
|
|
expect(getManifestSpy).toHaveBeenCalled();
|
|
|
|
expect(getManifestSpy).not.toHaveBeenCalled();
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
`Attempting to download ${versionSpec}...`
|
|
|
|
`Attempting to download ${versionSpec}...`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@@ -417,7 +415,7 @@ describe('setup-node', () => {
|
|
|
|
|
|
|
|
|
|
|
|
await main.run();
|
|
|
|
await main.run();
|
|
|
|
|
|
|
|
|
|
|
|
expect(getManifestSpy).toHaveBeenCalled();
|
|
|
|
expect(getManifestSpy).not.toHaveBeenCalled();
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
`Attempting to download ${versionSpec}...`
|
|
|
|
`Attempting to download ${versionSpec}...`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@@ -512,15 +510,13 @@ describe('setup-node', () => {
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
'Attempt to resolve the latest version from manifest...'
|
|
|
|
'Attempt to resolve the latest version from manifest...'
|
|
|
|
);
|
|
|
|
);
|
|
|
|
expect(dbgSpy).toHaveBeenCalledWith('No manifest cached');
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(dbgSpy).toHaveBeenCalledWith(
|
|
|
|
'Failed to resolve version 12 from manifest'
|
|
|
|
'Getting manifest from actions/node-versions@main'
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
expect(logSpy).toHaveBeenCalledWith("Resolved as '12.16.2'");
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('check latest version and install it from manifest', async () => {
|
|
|
|
it('check latest version and install it from node dist', async () => {
|
|
|
|
os.platform = 'linux';
|
|
|
|
os.platform = 'linux';
|
|
|
|
os.arch = 'x64';
|
|
|
|
os.arch = 'x64';
|
|
|
|
|
|
|
|
|
|
|
|
@@ -532,23 +528,19 @@ describe('setup-node', () => {
|
|
|
|
const toolPath = path.normalize('/cache/node/12.16.2/x64');
|
|
|
|
const toolPath = path.normalize('/cache/node/12.16.2/x64');
|
|
|
|
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
|
|
|
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
|
|
|
cacheSpy.mockImplementation(async () => toolPath);
|
|
|
|
cacheSpy.mockImplementation(async () => toolPath);
|
|
|
|
const expectedUrl =
|
|
|
|
|
|
|
|
'https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-linux-x64.tar.gz';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await main.run();
|
|
|
|
await main.run();
|
|
|
|
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
'Attempt to resolve the latest version from manifest...'
|
|
|
|
'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(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
`Acquiring 12.16.2 - ${os.arch} from ${expectedUrl}`
|
|
|
|
'Failed to resolve version 12 from manifest'
|
|
|
|
);
|
|
|
|
);
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('Extracting ...');
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
|
|
|
|
'Not found in manifest. Falling back to download directly from Node'
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('Attempting to download 12...');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('fallback to dist if version if not found in manifest', async () => {
|
|
|
|
it('fallback to dist if version if not found in manifest', async () => {
|
|
|
|
@@ -580,10 +572,6 @@ describe('setup-node', () => {
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
'Attempt to resolve the latest version from manifest...'
|
|
|
|
'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(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
`Failed to resolve version ${versionSpec} from manifest`
|
|
|
|
`Failed to resolve version ${versionSpec} from manifest`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@@ -607,9 +595,6 @@ describe('setup-node', () => {
|
|
|
|
|
|
|
|
|
|
|
|
// ... but not in the local cache
|
|
|
|
// ... but not in the local cache
|
|
|
|
findSpy.mockImplementation(() => '');
|
|
|
|
findSpy.mockImplementation(() => '');
|
|
|
|
getManifestSpy.mockImplementation(() => {
|
|
|
|
|
|
|
|
throw new Error('Unable to download manifest');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dlSpy.mockImplementation(async () => '/some/temp/path');
|
|
|
|
dlSpy.mockImplementation(async () => '/some/temp/path');
|
|
|
|
const toolPath = path.normalize('/cache/node/12.11.0/x64');
|
|
|
|
const toolPath = path.normalize('/cache/node/12.11.0/x64');
|
|
|
|
@@ -625,9 +610,6 @@ describe('setup-node', () => {
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
'Attempt to resolve the latest version from manifest...'
|
|
|
|
'Attempt to resolve the latest version from manifest...'
|
|
|
|
);
|
|
|
|
);
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
|
|
|
|
'Unable to resolve version from manifest...'
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
`Failed to resolve version ${versionSpec} from manifest`
|
|
|
|
`Failed to resolve version ${versionSpec} from manifest`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@@ -650,12 +632,12 @@ describe('setup-node', () => {
|
|
|
|
['*', '14.0.0'],
|
|
|
|
['*', '14.0.0'],
|
|
|
|
['-1', '12.16.2']
|
|
|
|
['-1', '12.16.2']
|
|
|
|
])(
|
|
|
|
])(
|
|
|
|
'find latest LTS version and resolve it from local cache (lts/%s)',
|
|
|
|
'fail to resolve LTS version without manifest (lts/%s)',
|
|
|
|
async (lts, expectedVersion) => {
|
|
|
|
async (lts, _expectedVersion) => {
|
|
|
|
// arrange
|
|
|
|
// arrange
|
|
|
|
inputs['node-version'] = `lts/${lts}`;
|
|
|
|
inputs['node-version'] = `lts/${lts}`;
|
|
|
|
|
|
|
|
|
|
|
|
const toolPath = path.normalize(`/cache/node/${expectedVersion}/x64`);
|
|
|
|
const toolPath = path.normalize('/cache/node/12.16.2/x64');
|
|
|
|
findSpy.mockReturnValue(toolPath);
|
|
|
|
findSpy.mockReturnValue(toolPath);
|
|
|
|
|
|
|
|
|
|
|
|
// act
|
|
|
|
// act
|
|
|
|
@@ -665,51 +647,23 @@ describe('setup-node', () => {
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
'Attempt to resolve LTS alias from manifest...'
|
|
|
|
'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 '${lts}' for Node version 'lts/${lts}'`
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(dbgSpy).toHaveBeenCalledWith(
|
|
|
|
|
|
|
|
`Found LTS release '${expectedVersion}' for Node version 'lts/${lts}'`
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
|
|
|
|
|
|
|
expect(cnSpy).toHaveBeenCalledWith(
|
|
|
|
expect(cnSpy).toHaveBeenCalledWith(
|
|
|
|
`::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
|
|
|
|
`::error::Unable to find LTS release '${lts}' for Node version 'lts/${lts}'.${osm.EOL}`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
it.each([
|
|
|
|
it.each([
|
|
|
|
[
|
|
|
|
['erbium', '12.16.2'],
|
|
|
|
'erbium',
|
|
|
|
['*', '14.0.0'],
|
|
|
|
'12.16.2',
|
|
|
|
['-1', '12.16.2']
|
|
|
|
'https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-linux-x64.tar.gz'
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
'*',
|
|
|
|
|
|
|
|
'14.0.0',
|
|
|
|
|
|
|
|
'https://github.com/actions/node-versions/releases/download/14.0.0-20200507.99/node-14.0.0-linux-x64.tar.gz'
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
'-1',
|
|
|
|
|
|
|
|
'12.16.2',
|
|
|
|
|
|
|
|
'https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-linux-x64.tar.gz'
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
])(
|
|
|
|
])(
|
|
|
|
'find latest LTS version and install it from manifest (lts/%s)',
|
|
|
|
'fail to install LTS version without manifest (lts/%s)',
|
|
|
|
async (lts, expectedVersion, expectedUrl) => {
|
|
|
|
async (lts, _expectedVersion) => {
|
|
|
|
// arrange
|
|
|
|
// arrange
|
|
|
|
inputs['node-version'] = `lts/${lts}`;
|
|
|
|
inputs['node-version'] = `lts/${lts}`;
|
|
|
|
|
|
|
|
|
|
|
|
const toolPath = path.normalize(`/cache/node/${expectedVersion}/x64`);
|
|
|
|
|
|
|
|
findSpy.mockImplementation(() => '');
|
|
|
|
findSpy.mockImplementation(() => '');
|
|
|
|
dlSpy.mockImplementation(async () => '/some/temp/path');
|
|
|
|
|
|
|
|
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
|
|
|
|
|
|
|
cacheSpy.mockImplementation(async () => toolPath);
|
|
|
|
|
|
|
|
const expectedMajor = expectedVersion.split('.')[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// act
|
|
|
|
// act
|
|
|
|
await main.run();
|
|
|
|
await main.run();
|
|
|
|
@@ -718,26 +672,8 @@ describe('setup-node', () => {
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
'Attempt to resolve LTS alias from manifest...'
|
|
|
|
'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 '${lts}' for Node version 'lts/${lts}'`
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(dbgSpy).toHaveBeenCalledWith(
|
|
|
|
|
|
|
|
`Found LTS release '${expectedVersion}' for Node version 'lts/${lts}'`
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
|
|
|
|
`Attempting to download ${expectedMajor}...`
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
|
|
|
|
`Acquiring ${expectedVersion} - ${os.arch} from ${expectedUrl}`
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('Extracting ...');
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('Adding to the cache ...');
|
|
|
|
|
|
|
|
expect(cnSpy).toHaveBeenCalledWith(
|
|
|
|
expect(cnSpy).toHaveBeenCalledWith(
|
|
|
|
`::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
|
|
|
|
`::error::Unable to find LTS release '${lts}' for Node version 'lts/${lts}'.${osm.EOL}`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@@ -755,9 +691,6 @@ describe('setup-node', () => {
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
'Attempt to resolve LTS alias from manifest...'
|
|
|
|
'Attempt to resolve LTS alias from manifest...'
|
|
|
|
);
|
|
|
|
);
|
|
|
|
expect(dbgSpy).toHaveBeenCalledWith(
|
|
|
|
|
|
|
|
'Getting manifest from actions/node-versions@main'
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(cnSpy).toHaveBeenCalledWith(
|
|
|
|
expect(cnSpy).toHaveBeenCalledWith(
|
|
|
|
`::error::Unable to parse LTS alias for Node version 'lts/'${osm.EOL}`
|
|
|
|
`::error::Unable to parse LTS alias for Node version 'lts/'${osm.EOL}`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@@ -776,12 +709,6 @@ describe('setup-node', () => {
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
'Attempt to resolve LTS alias from manifest...'
|
|
|
|
'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(
|
|
|
|
expect(cnSpy).toHaveBeenCalledWith(
|
|
|
|
`::error::Unable to find LTS release 'unknown' for Node version 'lts/unknown'.${osm.EOL}`
|
|
|
|
`::error::Unable to find LTS release 'unknown' for Node version 'lts/unknown'.${osm.EOL}`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@@ -791,11 +718,7 @@ describe('setup-node', () => {
|
|
|
|
// arrange
|
|
|
|
// arrange
|
|
|
|
inputs['node-version'] = 'lts/erbium';
|
|
|
|
inputs['node-version'] = 'lts/erbium';
|
|
|
|
|
|
|
|
|
|
|
|
// ... but not in the local cache
|
|
|
|
|
|
|
|
findSpy.mockImplementation(() => '');
|
|
|
|
findSpy.mockImplementation(() => '');
|
|
|
|
getManifestSpy.mockImplementation(() => {
|
|
|
|
|
|
|
|
throw new Error('Unable to download manifest');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// act
|
|
|
|
// act
|
|
|
|
await main.run();
|
|
|
|
await main.run();
|
|
|
|
@@ -804,11 +727,8 @@ describe('setup-node', () => {
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(
|
|
|
|
'Attempt to resolve LTS alias from manifest...'
|
|
|
|
'Attempt to resolve LTS alias from manifest...'
|
|
|
|
);
|
|
|
|
);
|
|
|
|
expect(dbgSpy).toHaveBeenCalledWith(
|
|
|
|
|
|
|
|
'Getting manifest from actions/node-versions@main'
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(cnSpy).toHaveBeenCalledWith(
|
|
|
|
expect(cnSpy).toHaveBeenCalledWith(
|
|
|
|
`::error::Unable to download manifest${osm.EOL}`
|
|
|
|
`::error::Unable to find LTS release 'erbium' for Node version 'lts/erbium'.${osm.EOL}`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@@ -817,35 +737,29 @@ describe('setup-node', () => {
|
|
|
|
it.each(['latest', 'current', 'node'])(
|
|
|
|
it.each(['latest', 'current', 'node'])(
|
|
|
|
'download the %s version if alias is provided',
|
|
|
|
'download the %s version if alias is provided',
|
|
|
|
async inputVersion => {
|
|
|
|
async inputVersion => {
|
|
|
|
// Arrange
|
|
|
|
|
|
|
|
inputs['node-version'] = inputVersion;
|
|
|
|
inputs['node-version'] = inputVersion;
|
|
|
|
|
|
|
|
|
|
|
|
os.platform = 'darwin';
|
|
|
|
os.platform = 'darwin';
|
|
|
|
os.arch = 'x64';
|
|
|
|
os.arch = 'x64';
|
|
|
|
|
|
|
|
|
|
|
|
findSpy.mockImplementation(() => '');
|
|
|
|
findSpy.mockImplementation(() => '');
|
|
|
|
getManifestSpy.mockImplementation(() => {
|
|
|
|
|
|
|
|
throw new Error('Unable to download manifest');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Act
|
|
|
|
|
|
|
|
await main.run();
|
|
|
|
await main.run();
|
|
|
|
|
|
|
|
|
|
|
|
// assert
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('Unable to download manifest');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('getting latest node version...');
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('getting latest node version...');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('latest alias syntax from cache', () => {
|
|
|
|
describe('latest alias syntax from cache', () => {
|
|
|
|
it.each(['latest', 'current', 'node'])(
|
|
|
|
it.each([
|
|
|
|
'download the %s version if alias is provided',
|
|
|
|
{versionSpec: 'latest', expectedVersion: {version: 'v14.1.0'}},
|
|
|
|
async inputVersion => {
|
|
|
|
{versionSpec: 'current', expectedVersion: {version: 'v14.1.0'}},
|
|
|
|
// Arrange
|
|
|
|
{versionSpec: 'node', expectedVersion: {version: 'v14.1.0'}}
|
|
|
|
inputs['node-version'] = inputVersion;
|
|
|
|
])(
|
|
|
|
const expectedVersion = nodeTestDist[0];
|
|
|
|
'resolve the $versionSpec version from cache',
|
|
|
|
|
|
|
|
async ({versionSpec, expectedVersion}) => {
|
|
|
|
|
|
|
|
inputs['node-version'] = versionSpec;
|
|
|
|
|
|
|
|
|
|
|
|
os.platform = 'darwin';
|
|
|
|
os.platform = 'darwin';
|
|
|
|
os.arch = 'x64';
|
|
|
|
os.arch = 'x64';
|
|
|
|
@@ -855,11 +769,8 @@ describe('setup-node', () => {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
findSpy.mockImplementation(() => toolPath);
|
|
|
|
findSpy.mockImplementation(() => toolPath);
|
|
|
|
|
|
|
|
|
|
|
|
// Act
|
|
|
|
|
|
|
|
await main.run();
|
|
|
|
await main.run();
|
|
|
|
|
|
|
|
|
|
|
|
// assert
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('getting latest node version...');
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('getting latest node version...');
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
|
|
|
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -887,12 +798,8 @@ describe('setup-node', () => {
|
|
|
|
inputs['mirror'] = 'https://my_mirror_url';
|
|
|
|
inputs['mirror'] = 'https://my_mirror_url';
|
|
|
|
inputs['mirror-token'] = 'faketoken';
|
|
|
|
inputs['mirror-token'] = 'faketoken';
|
|
|
|
|
|
|
|
|
|
|
|
const expectedUrl =
|
|
|
|
const expectedUrl = `https://my_mirror_url/dist/v${version}/node-v${version}-${platform}-${arch}.${fileExtension}`;
|
|
|
|
arch === 'x64'
|
|
|
|
|
|
|
|
? `https://github.com/actions/node-versions/releases/download/${version}/node-${version}-${platform}-${arch}.zip`
|
|
|
|
|
|
|
|
: `https://my_mirror_url/dist/v${version}/node-v${version}-${platform}-${arch}.${fileExtension}`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ... but not in the local cache
|
|
|
|
|
|
|
|
findSpy.mockImplementation(() => '');
|
|
|
|
findSpy.mockImplementation(() => '');
|
|
|
|
|
|
|
|
|
|
|
|
dlSpy.mockImplementation(async () => '/some/temp/path');
|
|
|
|
dlSpy.mockImplementation(async () => '/some/temp/path');
|
|
|
|
|