Skip to content

Commit 7ababba

Browse files
committed
Fix e2e test
1 parent e5523d6 commit 7ababba

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

.github/workflows/versions.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ jobs:
4242
uses: ./
4343
with:
4444
node-version: ${{ matrix.node-version }}
45+
- if: runner.os != 'Windows'
46+
name: Verify node and npm
47+
run: |
48+
. "$NVM_DIR/nvm.sh"
49+
[[ $(nvm version-remote "${{ matrix.node-version }}") =~ ^v([^.]*) ]]
50+
__tests__/verify-node.sh "${BASH_REMATCH[1]}"
51+
shell: bash
4552

4653
manifest:
4754
runs-on: ${{ matrix.os }}

__tests__/installer.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -839,9 +839,9 @@ describe('setup-node', () => {
839839
);
840840
});
841841

842-
it('find latest LTS version and resolve it from local cache (lts/-2)', async () => {
842+
it('find latest LTS version and resolve it from local cache (lts/-1)', async () => {
843843
// arrange
844-
inputs['node-version'] = 'lts/-2';
844+
inputs['node-version'] = 'lts/-1';
845845

846846
const toolPath = path.normalize('/cache/node/12.16.2/x64');
847847
findSpy.mockReturnValue(toolPath);
@@ -858,20 +858,20 @@ describe('setup-node', () => {
858858
);
859859
expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached');
860860
expect(dbgSpy).toHaveBeenCalledWith(
861-
`LTS alias '-2' for Node version 'lts/-2'`
861+
`LTS alias '-1' for Node version 'lts/-1'`
862862
);
863863
expect(dbgSpy).toHaveBeenCalledWith(
864-
`Found LTS release '12.16.2' for Node version 'lts/-2'`
864+
`Found LTS release '12.16.2' for Node version 'lts/-1'`
865865
);
866866
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
867867
expect(cnSpy).toHaveBeenCalledWith(
868868
`::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
869869
);
870870
});
871871

872-
it('find latest LTS version and install it from manifest (lts/-2)', async () => {
872+
it('find latest LTS version and install it from manifest (lts/-1)', async () => {
873873
// arrange
874-
inputs['node-version'] = 'lts/-2';
874+
inputs['node-version'] = 'lts/-1';
875875

876876
const toolPath = path.normalize('/cache/node/12.16.2/x64');
877877
findSpy.mockImplementation(() => '');
@@ -893,10 +893,10 @@ describe('setup-node', () => {
893893
);
894894
expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached');
895895
expect(dbgSpy).toHaveBeenCalledWith(
896-
`LTS alias '-2' for Node version 'lts/-2'`
896+
`LTS alias '-1' for Node version 'lts/-1'`
897897
);
898898
expect(dbgSpy).toHaveBeenCalledWith(
899-
`Found LTS release '12.16.2' for Node version 'lts/-2'`
899+
`Found LTS release '12.16.2' for Node version 'lts/-1'`
900900
);
901901
expect(logSpy).toHaveBeenCalledWith('Attempting to download 12...');
902902
expect(logSpy).toHaveBeenCalledWith(

dist/setup/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62479,8 +62479,8 @@ function resolveLtsAliasFromManifest(versionSpec, stable, manifest) {
6247962479
// Supported formats are `lts/<alias>`, `lts/*`, and `lts/-n`. Where asterisk means highest possible LTS and -n means the nth-highest.
6248062480
const n = Number(alias);
6248162481
const aliases = Object.fromEntries(manifest
62482-
.filter(x => x.stable === stable)
62483-
.map(x => { var _a; return [(_a = x.lts) === null || _a === void 0 ? void 0 : _a.toLowerCase(), x]; }));
62482+
.filter(x => x.stable === stable && x.lts)
62483+
.map(x => [x.lts.toLowerCase(), x]));
6248462484
const numbered = Object.values(aliases);
6248562485
const release = alias === '*'
6248662486
? numbered[numbered.length - 1]

src/installer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ function resolveLtsAliasFromManifest(
222222
const n = Number(alias);
223223
const aliases = Object.fromEntries(
224224
manifest
225-
.filter(x => x.stable === stable)
226-
.map(x => [x.lts?.toLowerCase(), x])
225+
.filter(x => x.stable === stable && x.lts)
226+
.map(x => [x.lts!.toLowerCase(), x])
227227
);
228228
const numbered = Object.values(aliases);
229229
const release =

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy