SIGN IN SIGN UP

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

## 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

Copilot-Session: 48e629f8-eb5a-467c-970b-feb313628c00
M
martin committed
a8c9b2fe25342967be48eba3f792218c6becca8a
Parent: da50c34
Committed by GitHub <noreply@github.com> on 8/25/2026, 8:22:27 PM