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

test: adds tests for .versionrc.json usage #381

Merged
merged 1 commit into from
Jun 17, 2019
Merged
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
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