Skip to content

Commit

Permalink
fix: format the annotated tag message (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
nexdrew authored and bcoe committed May 1, 2016
1 parent d20f36e commit 8f02736
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function formatCommitMessage (msg, newVersion) {

function tag (newVersion, argv) {
checkpoint('tagging release %s', [newVersion])
exec('git tag -a v' + newVersion + ' -m "' + argv.message + '"', function (err, stdout, stderr) {
exec('git tag -a v' + newVersion + ' -m "' + formatCommitMessage(argv.message, newVersion) + '"', function (err, stdout, stderr) {
var errMessage = null
if (err) errMessage = err.message
if (stderr) errMessage = stderr
Expand Down
17 changes: 17 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,21 @@ describe('cli', function () {
var content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.match(/this is my fairly long commit message which is testing whether or not we allow for long commit messages/)
})

it('formats the commit and tag messages appropriately', function () {
fs.writeFileSync('package.json', JSON.stringify({
version: '1.0.0'
}), 'utf-8')

commit('feat: first commit')
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
commit('feat: new feature!')

shell.exec(cliPath).code.should.equal(0)

// check last commit message
shell.exec('git log --oneline -n1').stdout.should.match(/chore\(release\)\: 1\.1\.0/)
// check annotated tag message
shell.exec('git tag -l -n1 v1.1.0').stdout.should.match(/chore\(release\)\: 1\.1\.0/)
})
})

0 comments on commit 8f02736

Please sign in to comment.