Skip to content

Commit 8df6705

Browse files
authored
🐛 Fix updating changelog after tagging a version (#115)
1 parent 9e18766 commit 8df6705

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

packages/gitmoji-changelog-cli/src/cli.e2e.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,24 @@ describe('generate changelog', () => {
128128

129129
expect(getChangelog()).includes(['1.0.0', '2.0.0'])
130130
})
131+
132+
it('should get two versions 1.0.0 and 2.0.0 while updating changelog after tagging a version 2.0.0', async () => {
133+
await makeChanges('file1')
134+
await commit(':sparkles: Add some file')
135+
await bumpVersion('1.0.0')
136+
gitmojiChangelog()
137+
await commit(':bookmark: Version 1.0.0')
138+
await tag('1.0.0')
139+
140+
await makeChanges('file2')
141+
await commit(':sparkles: Add another file')
142+
await bumpVersion('2.0.0')
143+
await tag('2.0.0')
144+
gitmojiChangelog()
145+
146+
expect(getChangelog()).includes(['1.0.0', '2.0.0'])
147+
})
148+
131149
it("should get two versions 1.0.0 and 2.0.0 while updating changelog by calling cli with 2.0.0 and having package.json's version set to 1.0.0", async () => {
132150
await makeChanges('file1')
133151
await commit(':sparkles: Add some file')

packages/gitmoji-changelog-core/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ async function generateChangelog(options = {}) {
159159
groupSimilarCommits,
160160
})
161161

162-
if (mode === 'update' && isEmpty(changes[0].groups)) {
162+
if (mode === 'update' && changes.length === 1 && isEmpty(changes[0].groups)) {
163163
throw new Error('No changes found. You may need to fetch or pull the last changes.')
164164
}
165165

0 commit comments

Comments
 (0)