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

feat: add support for Node.js 22 #1056

Merged
merged 2 commits into from
May 8, 2024
Merged

feat: add support for Node.js 22 #1056

merged 2 commits into from
May 8, 2024

Conversation

targos
Copy link
Member

@targos targos commented Apr 25, 2024

No description provided.

@targos
Copy link
Member Author

targos commented Apr 25, 2024

Blocked on nodejs/node#52682

@targos
Copy link
Member Author

targos commented May 8, 2024

There's another issue on Windows with v22. It's related to npm install: https://github.com/nodejs/citgm/actions/runs/8831148407/job/24712997804?pr=1056

@richardlau
Copy link
Member

richardlau commented May 8, 2024

There's another issue on Windows with v22. It's related to npm install: https://github.com/nodejs/citgm/actions/runs/8831148407/job/24712997804?pr=1056

I don't think that's Windows specific -- it looks like the error message has subtly changed in newer npm (the Windows run picked up Node.js 22.1.0 but the macOS and Linux runs used 22.0.0).

Locally with Linux:

Prior to Node.js 22.1.0:

$ nvm use 22.0.0
Now using node v22.0.0 (npm v10.5.1)
$ npm install THIS-WILL-FAIL
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/THIS-WILL-FAIL - Not found
npm ERR! 404
npm ERR! 404  'THIS-WILL-FAIL@*' is not in this registry.
npm ERR! 404 This package name is not valid, because
npm ERR! 404  1. name can no longer contain capital letters
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in: /home/rlau/.npm/_logs/2024-05-08T15_13_37_587Z-debug-0.log
$

With Node.js 22.1.0:

$ nvm use 22.1.0
Now using node v22.1.0 (npm v10.7.0)
$ npm install THIS-WILL-FAIL
npm error code E404
npm error 404 Not Found - GET https://registry.npmjs.org/THIS-WILL-FAIL - Not found
npm error 404
npm error 404  'THIS-WILL-FAIL@*' is not in this registry.
npm error 404 This package name is not valid, because
npm error 404  1. name can no longer contain capital letters
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.

npm error A complete log of this run can be found in: /home/rlau/.npm/_logs/2024-05-08T15_14_15_812Z-debug-0.log
$

i.e. ERR! is now error and no longer matches the regexp:

const expected = {
testOutput: /^$/,
testError: /npm ERR! 404 Not [Ff]ound\s*(:)? .*THIS-WILL-FAIL(@0\.0\.1)?/
};
try {
await packageManagerInstall('npm', context);
} catch (err) {
t.notOk(context.module.flaky, 'Module failed is not flaky');
t.equal(err && err.message, 'Install Failed');
t.match(context, expected, 'Install error reported');
}

We could change the regexp to:

   testError: /npm (ERR!|error) 404 Not [Ff]ound\s*(:)? .*THIS-WILL-FAIL(@0\.0\.1)?/ 

or wildcard out (i.e. .*) the ERR! part.

Newer versions of npm have subtly changed the prefix for error output.
Amend `test-npm-install` to work with both older and newer npm output.
@richardlau
Copy link
Member

I've pushed an update to the test.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.74%. Comparing base (12e6902) to head (eb1136f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1056      +/-   ##
==========================================
- Coverage   96.35%   92.74%   -3.61%     
==========================================
  Files          29       29              
  Lines        2192     2192              
==========================================
- Hits         2112     2033      -79     
- Misses         80      159      +79     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@targos
Copy link
Member Author

targos commented May 8, 2024

Thanks, lgtm

@targos targos merged commit 92123f7 into nodejs:main May 8, 2024
14 checks passed
@targos targos deleted the node-22 branch May 8, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants