Skip to content

Commit c6b4879

Browse files
committed
fix(upgrade): add blank lines around changelog in upgrade output
Add a blank line before and after the changelog section in the upgrade command output for better visual separation from the status/metadata block.
1 parent 5faf1dd commit c6b4879

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)