Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node-version-file support for use-node-version in .npmrc files #1253

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add .npmrc unit and E2E tests
  • Loading branch information
mcevoypeter authored and kyle-leonhard committed Mar 19, 2025
commit ff0f4b6812a8b4151248b9384bef8fbf11096415
2 changes: 1 addition & 1 deletion .github/workflows/versions.yml
Original file line number Diff line number Diff line change
@@ -158,7 +158,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version-file:
[.nvmrc, .tool-versions, .tool-versions-node, package.json]
[.nvmrc, .tool-versions, .tool-versions-node, package.json, .npmrc]
steps:
- uses: actions/checkout@v4
- name: Setup node from node version file
1 change: 1 addition & 0 deletions __tests__/data/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use-node-version=20.0.0
3 changes: 3 additions & 0 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
@@ -103,10 +103,13 @@ describe('main tests', () => {
${''} | ${''}
${'unknown format'} | ${'unknown format'}
${' 14.1.0 '} | ${'14.1.0'}
${'use-node-version=lts/iron'} | ${'lts/iron'}
${'{"volta": {"node": ">=14.0.0 <=17.0.0"}}'}| ${'>=14.0.0 <=17.0.0'}
${'{"volta": {"extends": "./package.json"}}'}| ${'18.0.0'}
${'{"engines": {"node": "17.0.0"}}'} | ${'17.0.0'}
${'{}'} | ${null}
${'[section]use-node-version=16'} | ${null}
${'[section]\nuse-node-version=20'} | ${null}
`.it('parses "$contents"', ({contents, expected}) => {
const existsSpy = jest.spyOn(fs, 'existsSync');
existsSpy.mockImplementation(() => true);