Skip to content

Commit

Permalink
feat(preset): Add emoji to changelog group titles
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed Aug 27, 2017
1 parent 2486532 commit 507eece
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/commit-transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = (commit, context) => {
}

if (types[commit.type] && (types[commit.type].changelog || (commit.notes && commit.notes.length > 0))) {
commit.type = types[commit.type].title;
commit.type = `${types[commit.type].emoji ? `${types[commit.type].emoji} ` : ''}${types[commit.type].title}`;
} else {
return null;
}
Expand Down
12 changes: 12 additions & 0 deletions test/preset.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ test.serial('Include only commits with "changelog" set to "true"', async t => {
t.notRegex(log, /First fix/);
});

test.serial('Include type emoji in group titles', async t => {
const log = await changelog(['fix(scope1): First fix', 'feat(scope2): Second feature'], {
types: {
feat: {title: 'Feature title', changelog: true, emoji: '✨'},
fix: {title: 'Fix title', changelog: true, emoji: '🐛'},
},
});

t.regex(log, /### ✨ Feature title/);
t.regex(log, /### 🐛 Fix title/);
});

test.serial('Include commits with breaking changes even if "changelog" is not set to "true"', async t => {
const log = await changelog(
[
Expand Down

0 comments on commit 507eece

Please sign in to comment.