Skip to content

Commit a9b1bfe

Browse files
authored
🐛 Fix init command (#204)
1 parent cdf76f9 commit a9b1bfe

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,16 @@ describe('generate changelog', () => {
8181
expect(getChangelog()).includes(['1.0.0'])
8282
})
8383

84+
it("should get a 1.0.0 version while initializing changelog by calling cli with explicit init argument and having package.json's version set to 1.0.0", async () => {
85+
await makeChanges('file1')
86+
await commit(':sparkles: Add some file')
87+
await bumpVersion('1.0.0')
88+
gitmojiChangelog(['init'])
89+
await commit(':bookmark: Version 1.0.0')
90+
91+
expect(getChangelog()).includes(['1.0.0'])
92+
})
93+
8494
it('should use a custom commit mapping to create commit categories', async () => {
8595
makeCustomConfig({
8696
commitMapping: [

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ yargs
3737
execute(mode)(argv)
3838
})
3939

40-
.command('init', 'Initialize changelog from tags', noop, execute('init'))
40+
.command('init', 'Initialize changelog from tags', noop, (argv) => execute('init')({ ...argv, release: 'from-package' }))
4141

4242
.command('update [release]', 'Update changelog with a new version', (command) => {
4343
command.positional('release', {

0 commit comments

Comments
 (0)