mirror of
https://github.com/pnpm/pnpm.git
synced 2026-07-25 07:03:03 -04:00
test: add test for install summary without updated manifest log
Add a reporter test verifying that when packageManifestLogger only emits the initial manifest (as happens during dry runs), the summary correctly shows only root-level changes without false dependency type diffs. Also add changeset for the install summary fix. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
6
.changeset/fix-install-summary.md
Normal file
6
.changeset/fix-install-summary.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/resolve-dependencies": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Fixed the install summary in workspaces by setting recursive config before reporter initialization and skipping manifest logging during dry runs.
|
||||
@@ -38,6 +38,54 @@ const h1 = chalk.cyanBright
|
||||
|
||||
const EOL = '\n'
|
||||
|
||||
test('does not show false dependency changes when updated manifest is not logged', async () => {
|
||||
const prefix = '/home/jane/project'
|
||||
const output$ = toOutput$({
|
||||
context: {
|
||||
argv: ['install'],
|
||||
config: { dir: prefix } as Config,
|
||||
},
|
||||
streamParser: createStreamParser(),
|
||||
})
|
||||
|
||||
// During a dry run, only the initial manifest is logged (no updated manifest).
|
||||
// The summary should only show root-level added packages, not false dependency type changes.
|
||||
packageManifestLogger.debug({
|
||||
initial: {
|
||||
name: 'foo',
|
||||
version: '1.0.0',
|
||||
|
||||
dependencies: {
|
||||
'is-positive': '^1.0.0',
|
||||
},
|
||||
devDependencies: {
|
||||
'is-negative': '^1.0.0',
|
||||
},
|
||||
},
|
||||
prefix,
|
||||
})
|
||||
rootLogger.debug({
|
||||
added: {
|
||||
dependencyType: 'prod',
|
||||
id: 'registry.npmjs.org/is-positive/1.0.0',
|
||||
name: 'is-positive',
|
||||
realName: 'is-positive',
|
||||
version: '1.0.0',
|
||||
},
|
||||
prefix,
|
||||
})
|
||||
summaryLogger.debug({ prefix })
|
||||
|
||||
expect.assertions(1)
|
||||
|
||||
const output = await firstValueFrom(output$.pipe(take(1), map(normalizeNewline)))
|
||||
// Should only show the added package, not re-list existing deps as added/removed
|
||||
expect(output).toBe(EOL + `\
|
||||
${h1('dependencies:')}
|
||||
${ADD} is-positive ${versionColor('1.0.0')}
|
||||
`)
|
||||
})
|
||||
|
||||
test('prints summary (of current package only)', async () => {
|
||||
const prefix = '/home/jane/project'
|
||||
const output$ = toOutput$({
|
||||
|
||||
Reference in New Issue
Block a user