Skip to content

Commit

Permalink
test: adds tests for .versionrc.json usage (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbottigliero authored and bcoe committed Jun 17, 2019
1 parent b621a4a commit 053a24c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,21 @@ describe('cli', function () {
})

describe('precommit hook', function () {
it('should run the precommit hook when provided via .versionrc.json (#371)', function () {
fs.writeFileSync('.versionrc.json', JSON.stringify({
'scripts': {
'precommit': 'node scripts/precommit'
}
}), 'utf-8')

writeHook('precommit')
fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')
commit('feat: first commit')
let result = execCli()
result.code.should.equal(0)
result.stderr.should.match(/precommit ran/)
})

it('should run the precommit hook when provided', function () {
writePackageJson('1.0.0', {
'standard-version': {
Expand Down Expand Up @@ -1071,6 +1086,19 @@ describe('standard-version', function () {
content.should.include('http://www.foo.com/1')
})

it('reads config from .versionrc.json', function () {
// write configuration that overrides default issue
// URL format.
fs.writeFileSync('.versionrc.json', JSON.stringify({
issueUrlFormat: 'http://www.foo.com/{{id}}'
}), 'utf-8')
commit('feat: another commit addresses issue #1')
execCli()
// CHANGELOG should have the new issue URL format.
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.include('http://www.foo.com/1')
})

it('.versionrc : releaseCommitMessageFormat', function () {
// write configuration that overrides default issue
// URL format.
Expand Down

0 comments on commit 053a24c

Please sign in to comment.