Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions @commitlint/cz-commitlint/src/SectionBody.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,13 @@ describe('combineCommitMessage', () => {
});
expect(commitMessage).toBe('This is issue body message.');
});

test('should use issueBody when body message is empty string but commit has issue note', () => {
setRules({});
const commitMessage = combineCommitMessage({
body: '',
issuesBody: 'This is issue body message.',
});
expect(commitMessage).toBe('This is issue body message.');
});
});
2 changes: 1 addition & 1 deletion @commitlint/cz-commitlint/src/SectionBody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function combineCommitMessage(answers: Answers): string {
const leadingBlankFn = getLeadingBlankFn(getRule('body', 'leading-blank'));
const {body, breakingBody, issuesBody} = answers;

const commitBody = body ?? breakingBody ?? issuesBody ?? '-';
const commitBody = body || breakingBody || issuesBody || '-';

if (commitBody) {
return leadingBlankFn(
Expand Down