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: update commit msg for when using commitAll #320

Merged
merged 3 commits into from Apr 8, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/lifecycles/commit.js
Expand Up @@ -31,6 +31,12 @@ function execCommit (args, newVersion) {
toAdd += ' ' + path.relative(process.cwd(), p)
}
})

if (args.commitAll) {
msg += ' and %s'
paths.push('all staged files')
}

checkpoint(args, msg, paths)
return runExec(args, 'git add' + toAdd + ' ' + args.infile)
.then(() => {
Expand Down
12 changes: 12 additions & 0 deletions test.js
Expand Up @@ -667,6 +667,18 @@ describe('cli', function () {
result.stdout.should.not.match(/npm publish/)
})

it('does not display `all staged files` without the --commit-all flag', function () {
var result = execCli()
result.code.should.equal(0)
result.stdout.should.not.match(/and all staged files/)
})

it('does display `all staged files` if the --commit-all flag is passed', function () {
var result = execCli('--commit-all')
result.code.should.equal(0)
result.stdout.should.match(/and all staged files/)
})

it('includes merge commits', function () {
var branchName = 'new-feature'
commit('feat: first commit')
Expand Down