mirror of
https://github.com/actions/setup-node.git
synced 2025-04-22 09:21:00 +00:00
Fix e2e test
This commit is contained in:
parent
e884a306f8
commit
db5bd66343
4 changed files with 20 additions and 12 deletions
8
.github/workflows/versions.yml
vendored
8
.github/workflows/versions.yml
vendored
|
@ -42,6 +42,14 @@ jobs:
|
|||
uses: ./
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
check-latest: true
|
||||
- if: runner.os != 'Windows'
|
||||
name: Verify node and npm
|
||||
run: |
|
||||
. "$NVM_DIR/nvm.sh"
|
||||
[[ $(nvm version-remote "${{ matrix.node-version }}") =~ ^v([^.]+) ]]
|
||||
__tests__/verify-node.sh "${BASH_REMATCH[1]}"
|
||||
shell: bash
|
||||
|
||||
manifest:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
|
|
@ -817,9 +817,9 @@ describe('setup-node', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('find latest LTS version and resolve it from local cache (lts/-2)', async () => {
|
||||
it('find latest LTS version and resolve it from local cache (lts/-1)', async () => {
|
||||
// arrange
|
||||
inputs['node-version'] = 'lts/-2';
|
||||
inputs['node-version'] = 'lts/-1';
|
||||
|
||||
const toolPath = path.normalize('/cache/node/12.16.2/x64');
|
||||
findSpy.mockReturnValue(toolPath);
|
||||
|
@ -836,10 +836,10 @@ describe('setup-node', () => {
|
|||
);
|
||||
expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached');
|
||||
expect(dbgSpy).toHaveBeenCalledWith(
|
||||
`LTS alias '-2' for Node version 'lts/-2'`
|
||||
`LTS alias '-1' for Node version 'lts/-1'`
|
||||
);
|
||||
expect(dbgSpy).toHaveBeenCalledWith(
|
||||
`Found LTS release '12.16.2' for Node version 'lts/-2'`
|
||||
`Found LTS release '12.16.2' for Node version 'lts/-1'`
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
||||
expect(cnSpy).toHaveBeenCalledWith(
|
||||
|
@ -847,9 +847,9 @@ describe('setup-node', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('find latest LTS version and install it from manifest (lts/-2)', async () => {
|
||||
it('find latest LTS version and install it from manifest (lts/-1)', async () => {
|
||||
// arrange
|
||||
inputs['node-version'] = 'lts/-2';
|
||||
inputs['node-version'] = 'lts/-1';
|
||||
|
||||
const toolPath = path.normalize('/cache/node/12.16.2/x64');
|
||||
findSpy.mockImplementation(() => '');
|
||||
|
@ -871,10 +871,10 @@ describe('setup-node', () => {
|
|||
);
|
||||
expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached');
|
||||
expect(dbgSpy).toHaveBeenCalledWith(
|
||||
`LTS alias '-2' for Node version 'lts/-2'`
|
||||
`LTS alias '-1' for Node version 'lts/-1'`
|
||||
);
|
||||
expect(dbgSpy).toHaveBeenCalledWith(
|
||||
`Found LTS release '12.16.2' for Node version 'lts/-2'`
|
||||
`Found LTS release '12.16.2' for Node version 'lts/-1'`
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith('Attempting to download 12...');
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
|
|
4
dist/setup/index.js
vendored
4
dist/setup/index.js
vendored
|
@ -70761,8 +70761,8 @@ function resolveLtsAliasFromManifest(versionSpec, stable, manifest) {
|
|||
// Supported formats are `lts/<alias>`, `lts/*`, and `lts/-n`. Where asterisk means highest possible LTS and -n means the nth-highest.
|
||||
const n = Number(alias);
|
||||
const aliases = Object.fromEntries(manifest
|
||||
.filter(x => x.stable === stable)
|
||||
.map(x => { var _a; return [(_a = x.lts) === null || _a === void 0 ? void 0 : _a.toLowerCase(), x]; }));
|
||||
.filter(x => x.lts && x.stable === stable)
|
||||
.map(x => [x.lts.toLowerCase(), x]));
|
||||
const numbered = Object.values(aliases);
|
||||
const release = alias === '*'
|
||||
? numbered[numbered.length - 1]
|
||||
|
|
|
@ -229,8 +229,8 @@ function resolveLtsAliasFromManifest(
|
|||
const n = Number(alias);
|
||||
const aliases = Object.fromEntries(
|
||||
manifest
|
||||
.filter(x => x.stable === stable)
|
||||
.map(x => [x.lts?.toLowerCase(), x])
|
||||
.filter(x => x.lts && x.stable === stable)
|
||||
.map(x => [x.lts!.toLowerCase(), x])
|
||||
);
|
||||
const numbered = Object.values(aliases);
|
||||
const release =
|
||||
|
|
Loading…
Add table
Reference in a new issue