Skip to content

fix: keep dry-run output valid json - #9823

Merged
martinrrm merged 1 commit into
latestfrom
fix/8565-dry-run-json
Aug 25, 2026
Merged

fix: keep dry-run output valid json#9823
martinrrm merged 1 commit into
latestfrom
fix/8565-dry-run-json

Conversation

@martinrrm

Copy link
Copy Markdown
Contributor

Summary

  • suppress human-readable reify diff lines when JSON output is requested
  • preserve detailed diff output for non-JSON --dry-run and --long commands
  • cover both --dry-run --json and --long --json

Background

Detailed dry-run diff output was introduced in npm 10.4.0 by #7133 without accounting for JSON mode. The structured JSON summary already contains the add, remove, and change details, so the extra text is redundant and makes stdout invalid JSON.

Related to #8567, with the regression coverage requested during review.

Testing

  • tap --no-coverage --no-check-coverage test/lib/utils/reify-output.js
  • eslint lib/utils/reify-output.js test/lib/utils/reify-output.js

Fixes #8565

Suppress human-readable reify diffs when JSON output is requested so stdout remains parseable.

Fixes #8565

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 48e629f8-eb5a-467c-970b-feb313628c00
@martinrrm
martinrrm requested review from a team as code owners July 30, 2026 21:54
@martinrrm
martinrrm merged commit a8c9b2f into latest Aug 25, 2026
26 checks passed
@martinrrm
martinrrm deleted the fix/8565-dry-run-json branch August 25, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] npm install --json no longer JSON

2 participants