Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: include merge commits in the changelog #139

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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