mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
fix: install exiting with 1 exit code and no error message (#9567)
close #9559
This commit is contained in:
6
.changeset/empty-files-laugh.md
Normal file
6
.changeset/empty-files-laugh.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/core": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Installation should not exit with an error if `strictPeerDependencies` is `true` but all issues are ignored by `peerDependencyRules` [#9505](https://github.com/pnpm/pnpm/pull/9505).
|
||||
@@ -444,7 +444,12 @@ function reportPeerDependencyIssuesError (
|
||||
strictPeerDependencies: false
|
||||
`)
|
||||
const rendered = renderPeerIssues(msg.issuesByProjects)
|
||||
if (!rendered) return null
|
||||
if (!rendered) {
|
||||
// This should never happen.
|
||||
return {
|
||||
title: err.message,
|
||||
}
|
||||
}
|
||||
return {
|
||||
title: err.message,
|
||||
body: `${rendered}
|
||||
|
||||
@@ -45,7 +45,7 @@ export function filterPeerDependencyIssues (
|
||||
newPeerDependencyIssuesByProjects[projectId] = { bad: {}, missing: {}, conflicts, intersections }
|
||||
for (const [peerName, issues] of Object.entries(missing)) {
|
||||
if (
|
||||
ignoreMissingMatcher(peerName)
|
||||
ignoreMissingMatcher(peerName) || issues.every(({ optional }) => optional)
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -207,3 +207,36 @@ test('filterPeerDependencyIssues() allowed versions', () => {
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
test('filterPeerDependencyIssues() ignores missing optional dependency issues', () => {
|
||||
expect(filterPeerDependencyIssues({
|
||||
'.': {
|
||||
missing: {
|
||||
aaa: [
|
||||
{
|
||||
parents: [
|
||||
{
|
||||
name: 'xxx',
|
||||
version: '1.0.0',
|
||||
}],
|
||||
|
||||
optional: true,
|
||||
wantedRange: '>=1.0.0 <3.0.0',
|
||||
},
|
||||
],
|
||||
},
|
||||
bad: {},
|
||||
conflicts: [],
|
||||
intersections: {},
|
||||
},
|
||||
}, {
|
||||
allowAny: [],
|
||||
})).toStrictEqual({
|
||||
'.': {
|
||||
bad: {},
|
||||
conflicts: [],
|
||||
intersections: {},
|
||||
missing: {},
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user