mirror of
https://github.com/actions/setup-node.git
synced 2025-04-22 09:21:00 +00:00
Add test for node-version *
This commit is contained in:
parent
17f8bd9264
commit
7b47010eac
2 changed files with 40 additions and 44 deletions
18
.github/workflows/versions.yml
vendored
18
.github/workflows/versions.yml
vendored
|
@ -127,6 +127,24 @@ jobs:
|
||||||
run: __tests__/verify-node.sh 0.12.18 SKIP_NPM
|
run: __tests__/verify-node.sh 0.12.18 SKIP_NPM
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
latest-version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Setup Node
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
node-version: '*'
|
||||||
|
check-latest: true
|
||||||
|
- name: Verify node and npm
|
||||||
|
run: |
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
[[ $(nvm version-remote node) =~ ^v([^.]+) ]]
|
||||||
|
__tests__/verify-node.sh "${BASH_REMATCH[1]}"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
arch:
|
arch:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -135,50 +135,28 @@ describe('setup-node', () => {
|
||||||
expect(versions?.length).toBe(23);
|
expect(versions?.length).toBe(23);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can find 12.16.2 from manifest on osx', async () => {
|
it.each([
|
||||||
os.platform = 'darwin';
|
['12.16.2', 'darwin', '12.16.2', 'Erbium'],
|
||||||
os.arch = 'x64';
|
['12', 'linux', '12.16.2', 'Erbium'],
|
||||||
let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo(
|
['10', 'win32', '10.20.1', 'Dubnium'],
|
||||||
'actions',
|
['*', 'linux', '14.0.0', 'Fermium']
|
||||||
'node-versions',
|
])(
|
||||||
'mocktoken'
|
'can find %s from manifest on %s',
|
||||||
);
|
async (versionSpec, platform, expectedVersion, expectedLts) => {
|
||||||
expect(versions).toBeDefined();
|
os.platform = platform;
|
||||||
let match = await tc.findFromManifest('12.16.2', true, versions);
|
os.arch = 'x64';
|
||||||
expect(match).toBeDefined();
|
let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo(
|
||||||
expect(match?.version).toBe('12.16.2');
|
'actions',
|
||||||
expect((match as any).lts).toBe('Erbium');
|
'node-versions',
|
||||||
});
|
'mocktoken'
|
||||||
|
);
|
||||||
it('can find 12 from manifest on linux', async () => {
|
expect(versions).toBeDefined();
|
||||||
os.platform = 'linux';
|
let match = await tc.findFromManifest(versionSpec, true, versions);
|
||||||
os.arch = 'x64';
|
expect(match).toBeDefined();
|
||||||
let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo(
|
expect(match?.version).toBe(expectedVersion);
|
||||||
'actions',
|
expect((match as any).lts).toBe(expectedLts);
|
||||||
'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
|
// Found in cache tests
|
||||||
|
|
Loading…
Add table
Reference in a new issue