Skip to content

Commit b6e1562

Browse files
dsolebcoe
authored andcommitted
fix: include merge commits in the changelog (#139)
BREAKING CHANGE: merge commits are now included in the CHANGELOG.
1 parent b747feb commit b6e1562

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function outputChangelog (argv, cb) {
6161
var content = ''
6262
var changelogStream = conventionalChangelog({
6363
preset: 'angular'
64-
})
64+
}, undefined, {merges: null})
6565
.on('error', function (err) {
6666
return cb(err)
6767
})

test.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,22 @@ var should = require('chai').should()
1414

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

17+
function branch (branch) {
18+
shell.exec('git branch ' + branch)
19+
}
20+
21+
function checkout (branch) {
22+
shell.exec('git checkout ' + branch)
23+
}
24+
1725
function commit (msg) {
1826
shell.exec('git commit --allow-empty -m"' + msg + '"')
1927
}
2028

29+
function merge (msg, branch) {
30+
shell.exec('git merge --no-ff -m"' + msg + '" ' + branch)
31+
}
32+
2133
function execCli (argString) {
2234
return shell.exec('node ' + cliPath + (argString != null ? ' ' + argString : ''))
2335
}
@@ -239,6 +251,25 @@ describe('cli', function () {
239251
result.code.should.equal(0)
240252
result.stdout.should.not.match(/npm publish/)
241253
})
254+
255+
it('includes merge commits', function () {
256+
var branchName = 'new-feature'
257+
commit('feat: first commit')
258+
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
259+
branch(branchName)
260+
checkout(branchName)
261+
commit('Implementing new feature')
262+
checkout('master')
263+
merge('feat: new feature from branch', branchName)
264+
265+
execCli().code.should.equal(0)
266+
267+
var content = fs.readFileSync('CHANGELOG.md', 'utf-8')
268+
content.should.match(/new feature from branch/)
269+
270+
var pkgJson = fs.readFileSync('package.json', 'utf-8')
271+
pkgJson.should.equal(['{', ' "version": "1.1.0"', '}', ''].join('\n'))
272+
})
242273
})
243274

244275
describe('standard-version', function () {

0 commit comments

Comments
 (0)