Skip to content

Commit 38a48b5

Browse files
authored
fix(upgrade): add blank lines around changelog in upgrade output (#642)
## Summary - Adds a blank line before and after the changelog section in `sentry cli upgrade` output for better readability - Single-line change in `formatUpgradeResult()` in `src/lib/formatters/human.ts` ### Before ``` ✓ Upgraded to 0.24.0-dev.1775146118 (from 0.24.0-dev.1775088345) Method: curl · Channel: nightly New Features ✨ • ... ``` ### After ``` ✓ Upgraded to 0.24.0-dev.1775146118 (from 0.24.0-dev.1775088345) Method: curl · Channel: nightly New Features ✨ • ... ```
1 parent 59c820e commit 38a48b5

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/lib/formatters/human.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2282,7 +2282,7 @@ export function formatUpgradeResult(data: UpgradeResult): string {
22822282
// Append changelog if available
22832283
const changelogOutput = formatChangelog(data);
22842284
if (changelogOutput) {
2285-
return `${result}\n${changelogOutput}`;
2285+
return `${result}\n\n${changelogOutput}\n`;
22862286
}
22872287

22882288
return result;

test/lib/formatters/human.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,4 +817,34 @@ describe("formatUpgradeResult", () => {
817817
expect(result).not.toContain("(from");
818818
});
819819
});
820+
821+
test("changelog is separated from metadata by a blank line", () => {
822+
withPlain(() => {
823+
const result = formatUpgradeResult({
824+
action: "upgraded",
825+
currentVersion: "0.5.0",
826+
targetVersion: "0.6.0",
827+
channel: "stable",
828+
method: "curl",
829+
forced: false,
830+
changelog: {
831+
fromVersion: "0.5.0",
832+
toVersion: "0.6.0",
833+
sections: [
834+
{ category: "features", markdown: "- add cool feature (#1)" },
835+
],
836+
totalItems: 1,
837+
truncated: false,
838+
originalCount: 1,
839+
},
840+
});
841+
// Blank line between metadata and changelog heading
842+
expect(result).toContain("Channel: stable\n\n");
843+
// Changelog content present
844+
expect(result).toContain("New Features");
845+
expect(result).toContain("add cool feature (#1)");
846+
// Trailing newline after changelog
847+
expect(result).toMatch(/\n$/);
848+
});
849+
});
820850
});

0 commit comments

Comments
 (0)