From b6e1562808cdc712e157dbb1d6607f0624981f66 Mon Sep 17 00:00:00 2001 From: Dave Date: Sun, 27 Nov 2016 08:05:00 +1100 Subject: [PATCH] fix: include merge commits in the changelog (#139) BREAKING CHANGE: merge commits are now included in the CHANGELOG. --- index.js | 2 +- test.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 9b84494ed..1b57b7837 100755 --- a/index.js +++ b/index.js @@ -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) }) diff --git a/test.js b/test.js index 0c03c4b97..51a72205b 100644 --- a/test.js +++ b/test.js @@ -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 : '')) } @@ -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 () {