1
0
Fork 0
mirror of https://github.com/actions/setup-node synced 2024-12-22 21:22:42 +00:00

Fix test volta priority (#577)

This commit is contained in:
Evgenii Korolevskii 2022-09-26 13:58:23 +02:00 committed by GitHub
parent 9f3a02bbd1
commit 969bd26639
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 948 additions and 948 deletions

View file

@ -95,6 +95,9 @@ jobs:
node-version-file: [.nvmrc, .tool-versions, package.json] node-version-file: [.nvmrc, .tool-versions, package.json]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Remove volta from package.json
shell: bash
run: cat <<< "$(jq 'del(.volta)' ./__tests__/data/package.json)" > ./__tests__/data/package.json
- name: Setup node from node version file - name: Setup node from node version file
uses: ./ uses: ./
with: with:
@ -110,15 +113,12 @@ jobs:
os: [ ubuntu-latest, windows-latest, macos-latest ] os: [ ubuntu-latest, windows-latest, macos-latest ]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Remove engines from package.json
shell: bash
run: cat <<< "$(jq 'del(.engines)' ./__tests__/data/package.json)" > ./__tests__/data/package.json
- name: Setup node from node version file - name: Setup node from node version file
uses: ./ uses: ./
with: with:
node-version-file: '__tests__/data/package.json' node-version-file: '__tests__/data/package.json'
- name: Verify node - name: Verify node
run: __tests__/verify-node.sh 14 run: __tests__/verify-node.sh 16
node-dist: node-dist:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}

View file

@ -3,6 +3,6 @@
"node": "^14.0.0" "node": "^14.0.0"
}, },
"volta": { "volta": {
"node": "14.0.0" "node": "16.0.0"
} }
} }

2
dist/setup/index.js vendored
View file

@ -73539,7 +73539,7 @@ function parseNodeVersionFile(contents) {
nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node; nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node;
} }
catch (_d) { catch (_d) {
core.warning('Node version file is not JSON file'); core.info('Node version file is not JSON file');
} }
if (!nodeVersion) { if (!nodeVersion) {
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m); const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);

View file

@ -502,7 +502,7 @@ export function parseNodeVersionFile(contents: string): string {
nodeVersion = JSON.parse(contents).volta?.node; nodeVersion = JSON.parse(contents).volta?.node;
if (!nodeVersion) nodeVersion = JSON.parse(contents).engines?.node; if (!nodeVersion) nodeVersion = JSON.parse(contents).engines?.node;
} catch { } catch {
core.warning('Node version file is not JSON file'); core.info('Node version file is not JSON file');
} }
if (!nodeVersion) { if (!nodeVersion) {