Files
pnpm/cli/default-reporter/test/reportingPeerDependencyIssues.ts
Zoltan Kochan 64393a3148 refactor: suggest "pnpm peers check" instead of rendering peer issues tree during install (#11133)
Instead of rendering the full peer dependency issues tree during installation,
suggest users run "pnpm peers check" to view the issues. Remove the now-unused
@pnpm/installing.render-peer-issues package.
2026-03-28 16:06:59 +01:00

88 lines
1.9 KiB
TypeScript

import { toOutput$ } from '@pnpm/cli.default-reporter'
import { peerDependencyIssuesLogger } from '@pnpm/core-loggers'
import {
createStreamParser,
logger,
} from '@pnpm/logger'
import { firstValueFrom } from 'rxjs'
test('print peer dependency issues warning', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
},
streamParser: createStreamParser(),
})
peerDependencyIssuesLogger.debug({
issuesByProjects: {
'.': {
missing: {},
bad: {
a: [
{
parents: [
{
name: 'b',
version: '1.0.0',
},
],
foundVersion: '2',
resolvedFrom: [],
optional: false,
wantedRange: '3',
},
],
},
conflicts: [],
intersections: {},
},
},
})
expect.assertions(1)
const output = await firstValueFrom(output$)
expect(output).toContain('pnpm peers check')
})
test('print peer dependency issues error', async () => {
const output$ = toOutput$({
context: { argv: ['install'] },
streamParser: createStreamParser(),
})
const err = Object.assign(new Error('some error'), {
code: 'ERR_PNPM_PEER_DEP_ISSUES',
issuesByProjects: {
'.': {
missing: {},
bad: {
a: [
{
foundVersion: '2',
parents: [
{
name: 'b',
version: '1.0.0',
},
],
optional: false,
resolvedFrom: [],
wantedRange: '3',
},
],
},
conflicts: [],
intersections: {},
},
},
})
logger.error(err, err)
expect.assertions(1)
const output = await firstValueFrom(output$)
expect(output).toContain('pnpm peers check')
})