mirror of
https://gitea.com/actions/setup-node.git
synced 2025-04-05 06:49:44 +00:00
Support lts/-n aliases (#481)
This commit is contained in:
@ -1,157 +1,183 @@
|
||||
[
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
{
|
||||
"version": "14.0.0",
|
||||
"stable": true,
|
||||
"lts": "Fermium",
|
||||
"release_url": "https://github.com/actions/node-versions/releases/tag/14.0.0-20200507.99",
|
||||
"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-20200507.99/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-20200507.99/node-14.0.0-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-14.0.0-win32-x64.7z",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200507.99/node-14.0.0-win32-x64.7z"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "13.13.0",
|
||||
"stable": true,
|
||||
"release_url": "https://github.com/actions/node-versions/releases/tag/13.13.0-20200507.97",
|
||||
"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-20200507.97/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-20200507.97/node-13.13.0-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-13.13.0-win32-x64.7z",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200507.97/node-13.13.0-win32-x64.7z"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "12.16.2",
|
||||
"stable": true,
|
||||
"lts": "Erbium",
|
||||
"release_url": "https://github.com/actions/node-versions/releases/tag/12.16.2-20200507.95",
|
||||
"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-20200507.95/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-20200507.95/node-12.16.2-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-12.16.2-win32-x64.7z",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-win32-x64.7z"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "12.0.0",
|
||||
"stable": true,
|
||||
"lts": "Erbium",
|
||||
"release_url": "https://github.com/actions/node-versions/releases/tag/12.0.0-20200507.71",
|
||||
"files": [
|
||||
{
|
||||
"filename": "node-12.0.0-darwin-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "darwin",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/12.0.0-20200507.71/node-12.0.0-darwin-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-12.0.0-linux-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "linux",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/12.0.0-20200507.71/node-12.0.0-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-12.0.0-win32-x64.7z",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/12.0.0-20200507.71/node-12.0.0-win32-x64.7z"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "10.20.1",
|
||||
"stable": true,
|
||||
"lts": "Dubnium",
|
||||
"release_url": "https://github.com/actions/node-versions/releases/tag/10.20.1-20200507.70",
|
||||
"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-20200507.70/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-20200507.70/node-10.20.1-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-10.20.1-win32-x64.7z",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200507.70/node-10.20.1-win32-x64.7z"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "8.17.0",
|
||||
"stable": true,
|
||||
"lts": "Carbon",
|
||||
"release_url": "https://github.com/actions/node-versions/releases/tag/8.17.0-20200507.37",
|
||||
"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-20200507.37/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-20200507.37/node-8.17.0-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-8.17.0-win32-x64.7z",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200507.37/node-8.17.0-win32-x64.7z"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "6.17.1",
|
||||
"stable": true,
|
||||
"lts": "Boron",
|
||||
"release_url": "https://github.com/actions/node-versions/releases/tag/6.17.1-20200529.2",
|
||||
"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-20200529.2/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-20200529.2/node-6.17.1-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-6.17.1-win32-x64.7z",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200529.2/node-6.17.1-win32-x64.7z"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -126,7 +126,7 @@ describe('setup-node', () => {
|
||||
'mocktoken'
|
||||
);
|
||||
expect(versions).toBeDefined();
|
||||
expect(versions?.length).toBe(6);
|
||||
expect(versions?.length).toBe(7);
|
||||
});
|
||||
|
||||
it('can mock dist versions', async () => {
|
||||
@ -228,7 +228,7 @@ describe('setup-node', () => {
|
||||
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';
|
||||
'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
|
||||
findSpy.mockImplementation(() => '');
|
||||
@ -266,7 +266,7 @@ describe('setup-node', () => {
|
||||
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';
|
||||
'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
|
||||
findSpy.mockImplementation(() => '');
|
||||
@ -435,7 +435,7 @@ describe('setup-node', () => {
|
||||
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';
|
||||
'https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-linux-x64.tar.gz';
|
||||
|
||||
await main.run();
|
||||
|
||||
@ -677,145 +677,102 @@ describe('setup-node', () => {
|
||||
inputs.stable = 'true';
|
||||
});
|
||||
|
||||
it('find latest LTS version and resolve it from local cache (lts/erbium)', async () => {
|
||||
// arrange
|
||||
inputs['node-version'] = 'lts/erbium';
|
||||
it.each([
|
||||
['erbium', '12.16.2'],
|
||||
['*', '14.0.0'],
|
||||
['-1', '12.16.2']
|
||||
])(
|
||||
'find latest LTS version and resolve it from local cache (lts/%s)',
|
||||
async (lts, expectedVersion) => {
|
||||
// arrange
|
||||
inputs['node-version'] = `lts/${lts}`;
|
||||
|
||||
const toolPath = path.normalize('/cache/node/12.16.2/x64');
|
||||
findSpy.mockReturnValue(toolPath);
|
||||
const toolPath = path.normalize(`/cache/node/${expectedVersion}/x64`);
|
||||
findSpy.mockReturnValue(toolPath);
|
||||
|
||||
// act
|
||||
await main.run();
|
||||
// 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}`
|
||||
);
|
||||
});
|
||||
// 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 '${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(
|
||||
`::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';
|
||||
it.each([
|
||||
[
|
||||
'erbium',
|
||||
'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)',
|
||||
async (lts, expectedVersion, expectedUrl) => {
|
||||
// arrange
|
||||
inputs['node-version'] = `lts/${lts}`;
|
||||
|
||||
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';
|
||||
const toolPath = path.normalize(`/cache/node/${expectedVersion}/x64`);
|
||||
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
|
||||
await main.run();
|
||||
// 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}`
|
||||
);
|
||||
});
|
||||
// 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 '${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(
|
||||
`::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
it('fail with unable to parse LTS alias (lts/)', async () => {
|
||||
// arrange
|
||||
|
Reference in New Issue
Block a user