citgm icon indicating copy to clipboard operation
citgm copied to clipboard

feat: add support for Node.js 22

Open targos opened this issue 1 year ago • 1 comments

targos avatar Apr 25 '24 10:04 targos

Blocked on https://github.com/nodejs/node/issues/52682

targos avatar Apr 25 '24 12:04 targos

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

targos avatar May 08 '24 04:05 targos

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:

https://github.com/nodejs/citgm/blob/12e6902b7a90c42edf60a1f4aa0ef9c19efdfddc/test/npm/test-npm-install.js#L93-L103

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.

richardlau avatar May 08 '24 15:05 richardlau

I've pushed an update to the test.

richardlau avatar May 08 '24 16:05 richardlau

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar May 08 '24 16:05 codecov-commenter

Thanks, lgtm

targos avatar May 08 '24 17:05 targos