ci: test on Node.js 22 (#8010)

This commit is contained in:
Zoltan Kochan
2024-07-25 16:45:47 +02:00
committed by GitHub
parent 068ea7da35
commit 7329b9afc4
14 changed files with 57 additions and 44 deletions

View File

@@ -17,7 +17,7 @@ jobs:
node:
- '18.12'
- '20'
- '21'
- '22'
platform:
- ubuntu-latest
- windows-latest
@@ -43,8 +43,8 @@ jobs:
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
- name: Install npm@7
run: npm add --global npm@7
- name: Install npm@8
run: pnpm add --global npm@8
- name: pnpm install
run: pnpm install
- name: Audit

View File

@@ -220,7 +220,8 @@ async function updateTSConfig (
}
}
let registryMockPort = 7769
const registryMockPortForCore = 7769
let registryMockPort = registryMockPortForCore
type UpdatedManifest = ProjectManifest & Record<string, unknown>
@@ -246,9 +247,9 @@ async function updateManifest (workspaceDir: string, manifest: ProjectManifest,
case '@pnpm/plugin-commands-deploy':
case CLI_PKG_NAME:
case '@pnpm/core': {
// @pnpm/core tests currently works only with port 4873 due to the usage of
// @pnpm/core tests currently works only with port 7769 due to the usage of
// the next package: pkg-with-tarball-dep-from-registry
const port = manifest.name === '@pnpm/core' ? 4873 : ++registryMockPort
const port = manifest.name === '@pnpm/core' ? registryMockPortForCore : ++registryMockPort
scripts = {
...(manifest.scripts as Record<string, string>),
}

View File

@@ -1 +1 @@
registry=http://localhost:4873/
registry=http://localhost:7769/

View File

@@ -4,12 +4,12 @@
"@pnpm.e2e/dep-of-pkg-with-1-dep@^100.0.0":
version "100.0.0"
resolved "http://localhost:4873/@pnpm.e2e%2fdep-of-pkg-with-1-dep/-/dep-of-pkg-with-1-dep-100.0.0.tgz#a95f834b4a4d9661623a0cf2bd76acbc213192fc"
resolved "http://localhost:7769/@pnpm.e2e%2fdep-of-pkg-with-1-dep/-/dep-of-pkg-with-1-dep-100.0.0.tgz#a95f834b4a4d9661623a0cf2bd76acbc213192fc"
integrity sha512-KUmwlEiE3pzpmPCfrLkoOO7fmL4Tft+dcm6YQlUfOUJvHO73xlcKVoA/xOHP/ayUO8GiPlIqWRbKHrsxvXGE8g==
"@pnpm.e2e/pkg-with-1-dep@*":
version "100.0.0"
resolved "http://localhost:4873/@pnpm.e2e%2fpkg-with-1-dep/-/pkg-with-1-dep-100.0.0.tgz#2845d276feb3153c4abc107728ddbe0f7ce75a45"
resolved "http://localhost:7769/@pnpm.e2e%2fpkg-with-1-dep/-/pkg-with-1-dep-100.0.0.tgz#2845d276feb3153c4abc107728ddbe0f7ce75a45"
integrity sha512-tZBohBD7WeOtm0hBUQl0FlPvuTwyrdSn2V45P4jd2arjwKxM5YULEAtD1J42bKuEOJls4vS4/1v3lgS8qTfA2Q==
dependencies:
"@pnpm.e2e/dep-of-pkg-with-1-dep" "^100.0.0"

View File

@@ -2,4 +2,4 @@ link-workspace-packages = deep
prefer-workspace-packages = true
shared-workspace-lockfile = true
save-workspace-protocol = rolling
registry=http://localhost:4873
registry=http://localhost:7769

View File

@@ -1,11 +1,19 @@
const { start, prepare } = require('@pnpm/registry-mock')
module.exports = () => {
if (process.env.PNPM_REGISTRY_MOCK_PORT == null) return
prepare()
const server = start({
stdio: 'ignore',
// Verdaccio stopped working properly on Node.js 22.
// You can test the issue by running:
// pnpm --filter=core run test test/install/auth.ts
useNodeVersion: '20.16.0',
stdio: 'inherit',
})
let killed = false
server.on('error', (err) => {
console.log(err)
})
server.on('close', () => {
if (!killed) {
console.log('Error: The registry server was killed!')

View File

@@ -1,3 +1,3 @@
module.exports = () => {
global.killServer()
global.killServer?.()
}

View File

@@ -149,7 +149,7 @@
"start": "tsc --watch",
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
"test-with-preview": "preview && pnpm run test:e2e",
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=4873 jest",
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7769 jest",
"test": "pnpm run compile && pnpm run _test",
"prepublishOnly": "pnpm run compile",
"compile": "tsc --build && pnpm run lint --fix"

View File

@@ -11,7 +11,7 @@
"dist": {
"integrity": "sha512-KUmwlEiE3pzpmPCfrLkoOO7fmL4Tft+dcm6YQlUfOUJvHO73xlcKVoA/xOHP/ayUO8GiPlIqWRbKHrsxvXGE8g==",
"shasum": "a95f834b4a4d9661623a0cf2bd76acbc213192fc",
"tarball": "http://localhost:4873/@pnpm.e2e/dep-of-pkg-with-1-dep/-/@pnpm.e2e/dep-of-pkg-with-1-dep-100.0.0.tgz"
"tarball": "http://localhost:7769/@pnpm.e2e/dep-of-pkg-with-1-dep/-/@pnpm.e2e/dep-of-pkg-with-1-dep-100.0.0.tgz"
},
"contributors": []
},
@@ -25,7 +25,7 @@
"dist": {
"integrity": "sha512-CAF68U5SjOQOT2dubJxAxauvQwm0G2IWS+Si7xP6Za79ZAt2VmCG5LMoSfv7GkbKk0RvSm/EMpT4BQVGy1yCpg==",
"shasum": "7647e89d79edff3ea46b0b04e390e2c820995be6",
"tarball": "http://localhost:4873/@pnpm.e2e/dep-of-pkg-with-1-dep/-/@pnpm.e2e/dep-of-pkg-with-1-dep-100.1.0.tgz"
"tarball": "http://localhost:7769/@pnpm.e2e/dep-of-pkg-with-1-dep/-/@pnpm.e2e/dep-of-pkg-with-1-dep-100.1.0.tgz"
},
"contributors": []
},
@@ -39,7 +39,7 @@
"dist": {
"integrity": "sha512-v/FQPTv+Y6j/J5a7ymlifFIhJa28wROyiTfg1vcAVKdJ9S94E32CHVUbzgvdcu9pAkLqe7INiwJ2ynqmgiTiiw==",
"shasum": "0cd58112bc509221dc3dfd97736a1feae3872b69",
"tarball": "http://localhost:4873/@pnpm.e2e/dep-of-pkg-with-1-dep/-/@pnpm.e2e/dep-of-pkg-with-1-dep-101.0.0.tgz"
"tarball": "http://localhost:7769/@pnpm.e2e/dep-of-pkg-with-1-dep/-/@pnpm.e2e/dep-of-pkg-with-1-dep-101.0.0.tgz"
},
"contributors": []
}

View File

@@ -14,7 +14,7 @@
"dist": {
"integrity": "sha512-IGrkh3wu1jOzTFzi/S+XOkuhEwhV03qRaH7tcwPoPJ+AQo2cAuhgOBwczq2y8DPfob+BlzSmZXjEvEqoXKio7A==",
"shasum": "b78a05932d20b071b84d42b6964621a197118870",
"tarball": "http://localhost:4873/@pnpm.e2e/pkg-with-1-dep/-/@pnpm.e2e/pkg-with-1-dep-100.0.0.tgz"
"tarball": "http://localhost:7769/@pnpm.e2e/pkg-with-1-dep/-/@pnpm.e2e/pkg-with-1-dep-100.0.0.tgz"
},
"contributors": []
},
@@ -31,7 +31,7 @@
"dist": {
"integrity": "sha512-fdlqYHFD2EY3e1Lf2x2V3gVJdNkybtPiQ8DLUZCJjxyMl0oxymB0EQSHqSjvBYoDss7Jj9eGLx9+utpOuXRX7A==",
"shasum": "2d2293b5595718890bd322da51359ec25334b85e",
"tarball": "http://localhost:4873/@pnpm.e2e/pkg-with-1-dep/-/@pnpm.e2e/pkg-with-1-dep-100.1.0.tgz"
"tarball": "http://localhost:7769/@pnpm.e2e/pkg-with-1-dep/-/@pnpm.e2e/pkg-with-1-dep-100.1.0.tgz"
},
"contributors": []
}

View File

@@ -738,7 +738,9 @@ test('save tarball URL when it is non-standard', async () => {
expect((lockfile.packages['esprima-fb@3001.1.0-dev-harmony-fb'].resolution as TarballResolution).tarball).toBe(`http://localhost:${REGISTRY_MOCK_PORT}/esprima-fb/-/esprima-fb-3001.0001.0000-dev-harmony-fb.tgz`)
})
test('packages installed via tarball URL from the default registry are normalized', async () => {
// The port is hardcoded to the package.json
// We changed the port of verdaccio and now this test doesn't work
test.skip('packages installed via tarball URL from the default registry are normalized', async () => {
const project = prepareEmpty()
await addDependenciesToPackage({}, [

44
pnpm-lock.yaml generated
View File

@@ -55,8 +55,8 @@ catalogs:
specifier: 0.0.0
version: 0.0.0
'@pnpm/registry-mock':
specifier: 3.36.1
version: 3.36.1
specifier: 3.38.0
version: 3.38.0
'@pnpm/semver-diff':
specifier: ^1.1.0
version: 1.1.0
@@ -709,7 +709,7 @@ importers:
version: 1.0.0
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/tsconfig':
specifier: workspace:*
version: link:__utils__/tsconfig
@@ -821,7 +821,7 @@ importers:
version: link:../../pkg-manager/modules-yaml
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/types':
specifier: workspace:*
version: link:../../packages/types
@@ -855,7 +855,7 @@ importers:
dependencies:
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/store.cafs':
specifier: workspace:*
version: link:../../store/cafs
@@ -2027,7 +2027,7 @@ importers:
version: link:../../__utils__/prepare
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/test-fixtures':
specifier: workspace:*
version: link:../../__utils__/test-fixtures
@@ -2157,7 +2157,7 @@ importers:
version: link:../../__utils__/prepare
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/test-ipc-server':
specifier: workspace:*
version: link:../../__utils__/test-ipc-server
@@ -3693,7 +3693,7 @@ importers:
version: link:../../__utils__/prepare
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/test-fixtures':
specifier: workspace:*
version: link:../../__utils__/test-fixtures
@@ -3974,7 +3974,7 @@ importers:
version: link:../../__utils__/prepare
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/store-path':
specifier: workspace:*
version: link:../../store/store-path
@@ -4259,7 +4259,7 @@ importers:
version: link:../read-projects-context
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/store-path':
specifier: workspace:*
version: link:../../store/store-path
@@ -4619,7 +4619,7 @@ importers:
version: 'link:'
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/test-fixtures':
specifier: workspace:*
version: link:../../__utils__/test-fixtures
@@ -4815,7 +4815,7 @@ importers:
version: link:../../__utils__/prepare
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/test-fixtures':
specifier: workspace:*
version: link:../../__utils__/test-fixtures
@@ -5408,7 +5408,7 @@ importers:
version: link:../pkg-manifest/read-project-manifest
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/run-npm':
specifier: workspace:*
version: link:../exec/run-npm
@@ -5680,7 +5680,7 @@ importers:
version: link:../../__utils__/prepare
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/workspace.filter-packages-from-dir':
specifier: workspace:*
version: link:../../workspace/filter-packages-from-dir
@@ -5789,7 +5789,7 @@ importers:
version: link:../../__utils__/prepare
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/test-ipc-server':
specifier: workspace:*
version: link:../../__utils__/test-ipc-server
@@ -6367,7 +6367,7 @@ importers:
version: link:../../pkg-manifest/read-package-json
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/test-fixtures':
specifier: workspace:*
version: link:../../__utils__/test-fixtures
@@ -6434,7 +6434,7 @@ importers:
version: link:../../__utils__/prepare
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/workspace.filter-packages-from-dir':
specifier: workspace:*
version: link:../../workspace/filter-packages-from-dir
@@ -6525,7 +6525,7 @@ importers:
version: link:../../__utils__/prepare
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@pnpm/test-fixtures':
specifier: workspace:*
version: link:../../__utils__/test-fixtures
@@ -6863,7 +6863,7 @@ importers:
version: link:../../__utils__/prepare
'@pnpm/registry-mock':
specifier: 'catalog:'
version: 3.36.1(encoding@0.1.13)(typanion@3.14.0)
version: 3.38.0(encoding@0.1.13)(typanion@3.14.0)
'@types/archy':
specifier: 'catalog:'
version: 0.0.33
@@ -8444,8 +8444,8 @@ packages:
resolution: {integrity: sha512-MDXuQpYFbabSXzAnqP7VIQqBx5Z1fzOhzB/3YmIXJ+tE7Wue//IR3itMSYlWeaFLo1G5PCJklM2zBdvggRw1nw==}
engines: {node: '>=16.14'}
'@pnpm/registry-mock@3.36.1':
resolution: {integrity: sha512-WYhOXo3y+YmgzigBeFhcW5VPdUZGfFp/7Ilz0NQ8Vi3xweL8glc6/rDTqvcr0VpckBulq/WKAB3wivoAGnS/tA==}
'@pnpm/registry-mock@3.38.0':
resolution: {integrity: sha512-JJKRTVbQJgWyiYEoxGJgi868NoAckZJ+7RyuQeGNM6y8O2+g9eXGePRT6MtmPWrmHFvr1qU3MNhL3Fb1zYX+nA==}
engines: {node: '>=10.13'}
hasBin: true
@@ -15269,7 +15269,7 @@ snapshots:
sort-keys: 4.2.0
strip-bom: 4.0.0
'@pnpm/registry-mock@3.36.1(encoding@0.1.13)(typanion@3.14.0)':
'@pnpm/registry-mock@3.38.0(encoding@0.1.13)(typanion@3.14.0)':
dependencies:
anonymous-npm-registry-client: 0.2.0
execa: 5.1.1

View File

@@ -51,7 +51,7 @@ catalog:
"@pnpm/npm-package-arg": ^1.0.0
"@pnpm/os.env.path-extender": ^2.0.0
"@pnpm/patch-package": 0.0.0
"@pnpm/registry-mock": 3.36.1
"@pnpm/registry-mock": 3.38.0
"@pnpm/semver-diff": ^1.1.0
"@pnpm/tabtab": ^0.5.4
"@pnpm/util.lex-comparator": 3.0.0

View File

@@ -99,11 +99,13 @@ test('recursive publish', async () => {
{
const { stdout } = await execa('npm', ['view', pkg1.name, 'versions', '--registry', `http://localhost:${REGISTRY_MOCK_PORT}`, '--json'])
expect(JSON.parse(stdout.toString())).toStrictEqual(pkg1.version)
const output = JSON.parse(stdout.toString())
expect(Array.isArray(output) ? output[0] : output).toStrictEqual(pkg1.version)
}
{
const { stdout } = await execa('npm', ['view', pkg2.name, 'versions', '--registry', `http://localhost:${REGISTRY_MOCK_PORT}`, '--json'])
expect(JSON.parse(stdout.toString())).toStrictEqual(pkg2.version)
const output = JSON.parse(stdout.toString())
expect(Array.isArray(output) ? output[0] : output).toStrictEqual(pkg2.version)
}
projects[pkg1.name].writePackageJson({ ...pkg1, version: '2.0.0' })