Skip to content
This repository has been archived by the owner on Feb 5, 2018. It is now read-only.

Commit

Permalink
fix(mergeConfig): respect issuePrefixes option
Browse files Browse the repository at this point in the history
Fixes #6
Closes #8
  • Loading branch information
hutson authored and stevemao committed May 7, 2016
1 parent 91255e8 commit 4be052b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/merge-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function mergeConfig(options, context, gitRawCommitsOpts, parserOpts, writerOpts
parserOpts.referenceActions = hostOpts.referenceActions;
}

if (hostOpts.issuePrefixes && parserOpts) {
if (_.isEmpty(parserOpts.issuePrefixes) && hostOpts.issuePrefixes) {
parserOpts.issuePrefixes = hostOpts.issuePrefixes;
}

Expand Down
38 changes: 38 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,44 @@ describe('conventionalChangelogCore', function() {
}));
});

it('should ignore other prefixes if an `issuePrefixes` option is not provided', function(done) {
gitDummyCommit('Custom prefix closes @42');

conventionalChangelogCore({}, {
host: 'github',
owner: 'b',
repository: 'a'
}, {}, {}).pipe(through(function(chunk) {
chunk = chunk.toString();

expect(chunk).to.include('](github/b/a/commit/');
expect(chunk).to.not.include('closes [#42](github/b/a/issues/42)');

done();
}));
});

it('should use custom prefixes if an `issuePrefixes` option is provided', function(done) {
gitDummyCommit('Custom prefix closes @42');
gitDummyCommit('Old prefix closes #71');

conventionalChangelogCore({}, {
host: 'github',
owner: 'b',
repository: 'a'
}, {}, {
issuePrefixes: ['@']
}).pipe(through(function(chunk) {
chunk = chunk.toString();

expect(chunk).to.include('](github/b/a/commit/');
expect(chunk).to.include('closes [#42](github/b/a/issues/42)');
expect(chunk).to.not.include('closes [#71](github/b/a/issues/71)');

done();
}));
});

it('should read host configs if only `parserOpts.referenceActions` is missing', function(done) {
conventionalChangelogCore({}, {
host: 'github',
Expand Down

0 comments on commit 4be052b

Please sign in to comment.