diff --git a/lib/lifecycles/bump.js b/lib/lifecycles/bump.js index ca6bc117c..bb75af268 100644 --- a/lib/lifecycles/bump.js +++ b/lib/lifecycles/bump.js @@ -8,9 +8,13 @@ const runLifecycleScript = require('../run-lifecycle-script') const semver = require('semver') const writeFile = require('../write-file') -const configsToUpdate = {} +var configsToUpdate = {} function Bump (args, pkg) { + // reset the cache of updated config files each + // time we perform the version bump step. + configsToUpdate = {} + if (args.skip.bump) return Promise.resolve() var newVersion = pkg.version return runLifecycleScript(args, 'prebump', null) diff --git a/test.js b/test.js index 5847e1b1e..d5fc9bbbe 100644 --- a/test.js +++ b/test.js @@ -690,38 +690,34 @@ describe('standard-version', function () { }) describe('skip', () => { - describe('skip bump and changelog generation phase', function () { - it('do not bump the version', function () { - let changelogContent = 'legacy header format\n' - writePackageJson('1.0.0') - fs.writeFileSync('CHANGELOG.md', changelogContent, 'utf-8') + it('allows bump and changelog generation to be skipped', function () { + let changelogContent = 'legacy header format\n' + writePackageJson('1.0.0') + fs.writeFileSync('CHANGELOG.md', changelogContent, 'utf-8') - commit('feat: first commit') - return execCliAsync('--skip.bump true --skip.changelog true') - .then(function () { - getPackageVersion().should.equal('1.0.0') - var content = fs.readFileSync('CHANGELOG.md', 'utf-8') - content.should.equal(changelogContent) - }) - }) + commit('feat: first commit') + return execCliAsync('--skip.bump true --skip.changelog true') + .then(function () { + getPackageVersion().should.equal('1.0.0') + var content = fs.readFileSync('CHANGELOG.md', 'utf-8') + content.should.equal(changelogContent) + }) }) - describe('skip commit phase', function () { - it('do not bump the version', function () { - let changelogContent = 'legacy header format\n' - writePackageJson('1.0.0') - fs.writeFileSync('CHANGELOG.md', changelogContent, 'utf-8') + it('allows the commit phase to be skipped', function () { + let changelogContent = 'legacy header format\n' + writePackageJson('1.0.0') + fs.writeFileSync('CHANGELOG.md', changelogContent, 'utf-8') - commit('feat: new feature from branch') - return execCliAsync('--skip.commit true') - .then(function () { - getPackageVersion().should.equal('1.1.0') - var content = fs.readFileSync('CHANGELOG.md', 'utf-8') - content.should.match(/new feature from branch/) - // check last commit message - shell.exec('git log --oneline -n1').stdout.should.match(/feat: new feature from branch/) - }) - }) + commit('feat: new feature from branch') + return execCliAsync('--skip.commit true') + .then(function () { + getPackageVersion().should.equal('1.1.0') + var content = fs.readFileSync('CHANGELOG.md', 'utf-8') + content.should.match(/new feature from branch/) + // check last commit message + shell.exec('git log --oneline -n1').stdout.should.match(/feat: new feature from branch/) + }) }) }) })