Skip to content

Commit abf48bb

Browse files
authored
test: add test for issuePrefixes flag (#431)
1 parent 84bb581 commit abf48bb

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,27 @@ describe('standard-version', function () {
11641164
shell.exec('git log --oneline -n1').should.include('1.1.0 is the version.')
11651165
})
11661166

1167+
it('.versionrc : issuePrefixes', function () {
1168+
// write configuration that overrides default issuePrefixes
1169+
// and reference prefix in issue URL format.
1170+
fs.writeFileSync('.versionrc', JSON.stringify({
1171+
issueUrlFormat: 'http://www.foo.com/{{prefix}}{{id}}',
1172+
issuePrefixes: ['ABC-']
1173+
}), 'utf-8')
1174+
commit('feat: another commit addresses issue ABC-1')
1175+
execCli()
1176+
// CHANGELOG should have the new issue URL format.
1177+
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
1178+
content.should.include('http://www.foo.com/ABC-1')
1179+
})
1180+
1181+
it('--issuePrefixes and --issueUrlFormat', function () {
1182+
commit('feat: another commit addresses issue ABC-1')
1183+
execCli('--issuePrefixes="ABC-" --issueUrlFormat="http://www.foo.com/{{prefix}}{{id}}"')
1184+
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
1185+
content.should.include('http://www.foo.com/ABC-1')
1186+
})
1187+
11671188
it('[LEGACY] supports --message (and single %s replacement)', function () {
11681189
commit('feat: another commit addresses issue #1')
11691190
execCli('--message="V:%s"')

0 commit comments

Comments
 (0)