Skip to content

Commit

Permalink
fix: commit body should be empty by default (#2980)
Browse files Browse the repository at this point in the history
  • Loading branch information
dangreen committed Jan 19, 2022
1 parent b0666be commit e6582e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions @commitlint/cz-commitlint/src/SectionBody.test.ts
Expand Up @@ -83,4 +83,12 @@ describe('combineCommitMessage', () => {
});
expect(commitMessage).toBe('This is issue body message.');
});

test('should return empty message when body is empty', () => {
setRules({});
const commitMessage = combineCommitMessage({
body: '',
});
expect(commitMessage).toBe('');
});
});
2 changes: 1 addition & 1 deletion @commitlint/cz-commitlint/src/SectionBody.ts
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

0 comments on commit e6582e0

Please sign in to comment.