Skip to content

Commit

Permalink
fix: fallback to shasum when integrity is not defined
Browse files Browse the repository at this point in the history
Some npm registries do not define an `integrity` field, in which case
we can try using the `shasum` field instead.
  • Loading branch information
aduh95 committed Jul 19, 2024
1 parent 67463b2 commit 553dd43
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
8 changes: 6 additions & 2 deletions sources/npmRegistryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function verifySignature({signatures, integrity, packageName, version}: {
export async function fetchLatestStableVersion(packageName: string) {
const metadata = await fetchAsJson(packageName, `latest`);

const {version, dist: {integrity, signatures}} = metadata;
const {version, dist: {integrity, signatures, shasum}} = metadata;

if (!shouldSkipIntegrityCheck()) {
verifySignature({
Expand All @@ -71,7 +71,11 @@ export async function fetchLatestStableVersion(packageName: string) {
});
}

return `${version}+sha512.${Buffer.from(integrity.slice(7), `base64`).toString(`hex`)}`;
return `${version}+${
integrity ?
`sha512.${Buffer.from(integrity.slice(7), `base64`).toString(`hex`)}`:

Check failure on line 76 in sources/npmRegistryUtils.ts

View workflow job for this annotation

GitHub Actions / Testing chores

Expected indentation of 6 spaces but found 5

Check failure on line 76 in sources/npmRegistryUtils.ts

View workflow job for this annotation

GitHub Actions / Testing chores

Operator ':' must be spaced
`sha1.${shasum}`

Check failure on line 77 in sources/npmRegistryUtils.ts

View workflow job for this annotation

GitHub Actions / Testing chores

Expected indentation of 6 spaces but found 5
}`;

Check failure on line 78 in sources/npmRegistryUtils.ts

View workflow job for this annotation

GitHub Actions / Testing chores

Expected indentation of 2 spaces but found 4
}

export async function fetchAvailableTags(packageName: string) {
Expand Down
3 changes: 1 addition & 2 deletions tests/_registryServer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function generateSignature(packageName, version) {
if (privateKey == null) return undefined;
const sign = createSign(`SHA256`).end(`${packageName}@${version}:${integrity}`);
return {signatures: [{
integrity,
keyid,
sig: sign.sign(privateKey, `base64`),
}]};
Expand All @@ -100,10 +101,8 @@ function generateVersionMetadata(packageName, version) {
[packageName]: `./bin/${packageName}.js`,
},
dist: {
integrity,
shasum,
size: mockPackageTarGz.length,
noattachment: false,
tarball: `https://registry.npmjs.org/${packageName}/-/${packageName}-${version}.tgz`,
...generateSignature(packageName, version),
},
Expand Down
26 changes: 26 additions & 0 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,32 @@ it(`should download yarn berry from custom registry`, async () => {
});
});

it(`should download latest pnpm from custom registry`, async () => {
await xfs.mktempPromise(async cwd => {
process.env.AUTH_TYPE = `COREPACK_NPM_TOKEN`; // See `_registryServer.mjs`
process.env.COREPACK_DEFAULT_TO_LATEST = `1`;
process.env.COREPACK_INTEGRITY_KEYS = `0`;

await xfs.writeJsonPromise(ppath.join(cwd, `package.json` as Filename), {
});

await expect(runCli(cwd, [`pnpm`, `--version`], true)).resolves.toMatchObject({

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / macos-latest w/ Node.js 22.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.13e0e63604dee098661c3fc33e5f1851ca05f8c7. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / macos-latest w/ Node.js 22.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.13e0e63604dee098661c3fc33e5f1851ca05f8c7. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / macos-latest w/ Node.js 22.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.13e0e63604dee098661c3fc33e5f1851ca05f8c7. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / macos-latest w/ Node.js 18.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.13e0e63604dee098661c3fc33e5f1851ca05f8c7. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / macos-latest w/ Node.js 18.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.13e0e63604dee098661c3fc33e5f1851ca05f8c7. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / macos-latest w/ Node.js 18.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.13e0e63604dee098661c3fc33e5f1851ca05f8c7. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest w/ Node.js 22.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.200615a6a8a1f376c9d0543059e5abafc236e524. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest w/ Node.js 22.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.200615a6a8a1f376c9d0543059e5abafc236e524. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest w/ Node.js 22.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.200615a6a8a1f376c9d0543059e5abafc236e524. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / macos-latest w/ Node.js 20.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.13e0e63604dee098661c3fc33e5f1851ca05f8c7. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / macos-latest w/ Node.js 20.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.13e0e63604dee098661c3fc33e5f1851ca05f8c7. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / macos-latest w/ Node.js 20.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.13e0e63604dee098661c3fc33e5f1851ca05f8c7. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / macos-latest w/ Node.js 21.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.13e0e63604dee098661c3fc33e5f1851ca05f8c7. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / macos-latest w/ Node.js 21.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.13e0e63604dee098661c3fc33e5f1851ca05f8c7. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / macos-latest w/ Node.js 21.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.13e0e63604dee098661c3fc33e5f1851ca05f8c7. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest w/ Node.js 18.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.200615a6a8a1f376c9d0543059e5abafc236e524. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest w/ Node.js 18.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.200615a6a8a1f376c9d0543059e5abafc236e524. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest w/ Node.js 18.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.200615a6a8a1f376c9d0543059e5abafc236e524. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest w/ Node.js 20.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.200615a6a8a1f376c9d0543059e5abafc236e524. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest w/ Node.js 20.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.200615a6a8a1f376c9d0543059e5abafc236e524. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest w/ Node.js 20.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.200615a6a8a1f376c9d0543059e5abafc236e524. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest w/ Node.js 21.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.200615a6a8a1f376c9d0543059e5abafc236e524. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest w/ Node.js 21.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.200615a6a8a1f376c9d0543059e5abafc236e524. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest w/ Node.js 21.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.200615a6a8a1f376c9d0543059e5abafc236e524. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / windows-latest w/ Node.js 22.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.77e133df93688a449ed457b4045390b21b10cc7a. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / windows-latest w/ Node.js 22.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.77e133df93688a449ed457b4045390b21b10cc7a. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / windows-latest w/ Node.js 22.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.77e133df93688a449ed457b4045390b21b10cc7a. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / windows-latest w/ Node.js 20.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.77e133df93688a449ed457b4045390b21b10cc7a. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / windows-latest w/ Node.js 20.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.77e133df93688a449ed457b4045390b21b10cc7a. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / windows-latest w/ Node.js 20.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.77e133df93688a449ed457b4045390b21b10cc7a. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / windows-latest w/ Node.js 21.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.77e133df93688a449ed457b4045390b21b10cc7a. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / windows-latest w/ Node.js 21.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.77e133df93688a449ed457b4045390b21b10cc7a. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / windows-latest w/ Node.js 21.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.77e133df93688a449ed457b4045390b21b10cc7a. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / windows-latest w/ Node.js 18.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.77e133df93688a449ed457b4045390b21b10cc7a. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / windows-latest w/ Node.js 18.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.77e133df93688a449ed457b4045390b21b10cc7a. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3

Check failure on line 899 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / windows-latest w/ Node.js 18.x

tests/main.test.ts > should download latest pnpm from custom registry

AssertionError: expected { exitCode: +0, …(2) } to match object { exitCode: +0, …(2) } - Expected + Received Object { "exitCode": 0, - "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48. + "stderr": "! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.77e133df93688a449ed457b4045390b21b10cc7a. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager + ", "stdout": "pnpm: Hello from custom registry ", } ❯ tests/main.test.ts:899:5 ❯ NodeFS.mktempPromise .yarn/cache/@yarnpkg-fslib-npm-3.1.0-821f4faf89-e327aaf73f.zip/node_modules/@yarnpkg/fslib/lib/xfs.js:86:24 ❯ tests/main.test.ts:891:3
exitCode: 0,
stdout: `pnpm: Hello from custom registry\n`,
stderr:

Check failure on line 902 in tests/main.test.ts

View workflow job for this annotation

GitHub Actions / Testing chores

Trailing spaces not allowed
`! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha1.d862ca5bedaa7d2328b8bde6ce2bac5141681f48.\n` +
`! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager\n`,
});

// Should keep working with cache
await expect(runCli(cwd, [`pnpm`, `--version`])).resolves.toMatchObject({
exitCode: 0,
stdout: `pnpm: Hello from custom registry\n`,
stderr: ``,
});
});
});

for (const authType of [`COREPACK_NPM_REGISTRY`, `COREPACK_NPM_TOKEN`, `COREPACK_NPM_PASSWORD`, `PROXY`]) {
describe(`custom registry with auth ${authType}`, () => {
beforeEach(() => {
Expand Down

0 comments on commit 553dd43

Please sign in to comment.