diff --git a/lib/parseArgs.js b/lib/parseArgs.js index de2bddbf..409d76d3 100644 --- a/lib/parseArgs.js +++ b/lib/parseArgs.js @@ -14,7 +14,7 @@ const helpScreen = ` -v, --version print version info and exit --disable-emoji don't add emoji to commit title --format custom formatting options for subject - --theme custm them override (default|gitmoji) + --theme custom them override (default|gitmoji) --non-interactive run git-cz in non-interactive mode non-interactive mode options: diff --git a/lib/themes/gitmoji.js b/lib/themes/gitmoji.js index 2a256778..adcec3d1 100644 --- a/lib/themes/gitmoji.js +++ b/lib/themes/gitmoji.js @@ -68,7 +68,7 @@ const rewrites = [ {from: 'passport-control', to: 'roles'}, {from: 'adhesive-bandage', to: 'patch'}, {from: 'monocle-face', to: 'data'}, - {from: 'coffin', to: 'remove'}, + {from: 'coffin', to: 'rip'}, ]; const list = ['chore']; diff --git a/test/__snapshots__/cli.test.js.snap b/test/__snapshots__/cli.test.js.snap index 397cac20..1676af70 100644 --- a/test/__snapshots__/cli.test.js.snap +++ b/test/__snapshots__/cli.test.js.snap @@ -11,6 +11,7 @@ exports[`git-cz --help 1`] = ` -v, --version print version info and exit --disable-emoji don't add emoji to commit title --format custom formatting options for subject + --theme custom them override (default|gitmoji) --non-interactive run git-cz in non-interactive mode non-interactive mode options: diff --git a/test/formatCommitMessage.test.js b/test/formatCommitMessage.test.js index 8e316186..b162825f 100644 --- a/test/formatCommitMessage.test.js +++ b/test/formatCommitMessage.test.js @@ -14,6 +14,7 @@ const defaultConfig = { minMessageLength: 3, questions: ['type', 'scope', 'subject', 'body', 'breaking', 'issues', 'lerna'], scopes: [], + theme: 'default', types: { chore: { description: 'Build process or auxiliary tool changes', @@ -68,6 +69,35 @@ const defaultConfig = { }, }; +const themeTypes = { + gitmoji: { + chore: { + code: ':computer_disk:', + description: 'Changes that don’t modify src or test files', + emoji: '💽️', + entity: '💽', + hidden: false, + name: 'computer-disk', + release: null, + section: 'Changes that don’t modify src or test files', + semver: null, + value: 'chore', + }, + rip: { + code: ':coffin:', + description: 'Remove dead code.', + emoji: '⚰️', + entity: '⚰', + hidden: false, + name: 'coffin', + release: null, + section: 'Remove dead code.', + semver: null, + value: 'rip', + }, + }, +}; + const defaultState = { answers: { body: '', @@ -145,4 +175,38 @@ describe('formatCommitMessage()', () => { expect(message).equal('First commit :(init)feat [skip ci]'); }); + + it('theme => gitmoji (no difference with feat)', () => { + const theme = 'gitmoji'; + const message = formatCommitMessage({ + ...defaultState, + config: { + ...defaultConfig, + disableEmoji: true, + theme, + }, + }); + + expect(message).equal('feat: First commit'); + }); + + it('theme => gitmoji (unique type)', () => { + const theme = 'gitmoji'; + const message = formatCommitMessage({ + ...defaultState, + answers: { + ...defaultState.answers, + subject: 'Last commit', + type: 'rip', + }, + config: { + ...defaultConfig, + disableEmoji: true, + theme, + types: themeTypes[theme], + }, + }); + + expect(message).equal('rip: Last commit'); + }); });