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

Read version from use-node-version key of .npmrc #1149

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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 committed Oct 20, 2024
commit b3a9c64ba88a653694da2940f78d5a7b56e2c028
2 changes: 1 addition & 1 deletion .github/workflows/versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
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
Expand Down
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
Expand Up @@ -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);
Expand Down