mirror of
https://github.com/actions/setup-node.git
synced 2026-03-01 06:41:05 +08:00
Addressed copilot suggestions
This commit is contained in:
parent
b50e0ad9a6
commit
c5d7f62348
@ -94,24 +94,26 @@ describe('main tests', () => {
|
|||||||
|
|
||||||
describe('getNodeVersionFromFile', () => {
|
describe('getNodeVersionFromFile', () => {
|
||||||
each`
|
each`
|
||||||
contents | expected
|
contents | expected
|
||||||
${'12'} | ${'12'}
|
${'12'} | ${'12'}
|
||||||
${'12.3'} | ${'12.3'}
|
${'12.3'} | ${'12.3'}
|
||||||
${'12.3.4'} | ${'12.3.4'}
|
${'12.3.4'} | ${'12.3.4'}
|
||||||
${'v12.3.4'} | ${'12.3.4'}
|
${'v12.3.4'} | ${'12.3.4'}
|
||||||
${'lts/erbium'} | ${'lts/erbium'}
|
${'lts/erbium'} | ${'lts/erbium'}
|
||||||
${'lts/*'} | ${'lts/*'}
|
${'lts/*'} | ${'lts/*'}
|
||||||
${'nodejs 12.3.4'} | ${'12.3.4'}
|
${'nodejs 12.3.4'} | ${'12.3.4'}
|
||||||
${'ruby 2.3.4\nnodejs 12.3.4\npython 3.4.5'} | ${'12.3.4'}
|
${'ruby 2.3.4\nnodejs 12.3.4\npython 3.4.5'} | ${'12.3.4'}
|
||||||
${''} | ${''}
|
${''} | ${''}
|
||||||
${'unknown format'} | ${'unknown format'}
|
${'unknown format'} | ${'unknown format'}
|
||||||
${' 14.1.0 '} | ${'14.1.0'}
|
${' 14.1.0 '} | ${'14.1.0'}
|
||||||
${'{}'} | ${null}
|
${'{}'} | ${null}
|
||||||
${'{"volta": {"node": ">=14.0.0 <=17.0.0"}}'} | ${'>=14.0.0 <=17.0.0'}
|
${'{"volta": {"node": ">=14.0.0 <=17.0.0"}}'} | ${'>=14.0.0 <=17.0.0'}
|
||||||
${'{"volta": {"extends": "./package.json"}}'} | ${'18.0.0'}
|
${'{"volta": {"extends": "./package.json"}}'} | ${'18.0.0'}
|
||||||
${'{"engines": {"node": "17.0.0"}}'} | ${'17.0.0'}
|
${'{"engines": {"node": "17.0.0"}}'} | ${'17.0.0'}
|
||||||
${'{"devEngines": {"runtime": {"name": "node", "version": "22.0.0"}}}'} | ${'22.0.0'}
|
${'{"devEngines": {"runtime": {"name": "node", "version": "22.0.0"}}}'} | ${'22.0.0'}
|
||||||
${'{"devEngines": {"runtime": [{"name": "bun"}, {"name": "node", "version": "22.0.0"}]}}'} | ${'22.0.0'}
|
${'{"devEngines": {"runtime": [{"name": "bun"}, {"name": "node", "version": "22.0.0"}]}}'} | ${'22.0.0'}
|
||||||
|
${'{"devEngines": {"runtime": {"name": "node", "version": "22.0.0"}}, "engines": {"node": "18.0.0"}}'} | ${'22.0.0'}
|
||||||
|
${'{"volta": {"node": "16.0.0"}, "devEngines": {"runtime": {"name": "node", "version": "22.0.0"}}, "engines": {"node": "18.0.0"}}'} | ${'16.0.0'}
|
||||||
`.it('parses "$contents"', ({contents, expected}) => {
|
`.it('parses "$contents"', ({contents, expected}) => {
|
||||||
const existsSpy = jest.spyOn(fs, 'existsSync');
|
const existsSpy = jest.spyOn(fs, 'existsSync');
|
||||||
existsSpy.mockImplementation(() => true);
|
existsSpy.mockImplementation(() => true);
|
||||||
|
|||||||
@ -112,6 +112,7 @@ When using the `package.json` input, the action will look in the following field
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
**Note:** The devEngines.runtime can either be an object or an array of objects
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user