Skip to content

Commit

Permalink
fix: include merge commits in the changelog (#139)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: merge commits are now included in the CHANGELOG.
  • Loading branch information
dsole authored and bcoe committed Nov 26, 2016
1 parent b747feb commit b6e1562
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function outputChangelog (argv, cb) {
var content = ''
var changelogStream = conventionalChangelog({
preset: 'angular'
})
}, undefined, {merges: null})
.on('error', function (err) {
return cb(err)
})
Expand Down
31 changes: 31 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,22 @@ var should = require('chai').should()

var cliPath = path.resolve(__dirname, './cli.js')

function branch (branch) {
shell.exec('git branch ' + branch)
}

function checkout (branch) {
shell.exec('git checkout ' + branch)
}

function commit (msg) {
shell.exec('git commit --allow-empty -m"' + msg + '"')
}

function merge (msg, branch) {
shell.exec('git merge --no-ff -m"' + msg + '" ' + branch)
}

function execCli (argString) {
return shell.exec('node ' + cliPath + (argString != null ? ' ' + argString : ''))
}
Expand Down Expand Up @@ -239,6 +251,25 @@ describe('cli', function () {
result.code.should.equal(0)
result.stdout.should.not.match(/npm publish/)
})

it('includes merge commits', function () {
var branchName = 'new-feature'
commit('feat: first commit')
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
branch(branchName)
checkout(branchName)
commit('Implementing new feature')
checkout('master')
merge('feat: new feature from branch', branchName)

execCli().code.should.equal(0)

var content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.match(/new feature from branch/)

var pkgJson = fs.readFileSync('package.json', 'utf-8')
pkgJson.should.equal(['{', ' "version": "1.1.0"', '}', ''].join('\n'))
})
})

describe('standard-version', function () {
Expand Down

0 comments on commit b6e1562

Please sign in to comment.