Skip to content

Commit

Permalink
fix(options): fix losing parserOpts without preset
Browse files Browse the repository at this point in the history
`preset.parserOpts` may be undefined if no preset was specified in the
options. `_.assign()` will return `undefined` if the first argument is
`undefined`.
  • Loading branch information
nmalaguti committed Oct 19, 2015
1 parent 9c359fa commit 53a18bc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function conventionalChangelog(options, context, gitRawCommitsOpts, parserOpts,
}

parserOpts = _.assign(
preset.parserOpts, {
{}, preset.parserOpts, {
warn: options.warn
},
parserOpts);
Expand Down
21 changes: 21 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -743,4 +743,25 @@ describe('conventionalChangelog', function() {
done();
}));
});

it('should pass `parserOpts` to conventional-commits-parser', function(done) {
writeFileSync('test9', '');
shell.exec('git add --all && git commit -m"test9" -m"Release note: super release!"');

conventionalChangelog({}, {}, {}, {
noteKeywords: [
"Release note"
]
})
.pipe(through(function(chunk, enc, cb) {
chunk = chunk.toString();

expect(chunk).to.include('* test9');
expect(chunk).to.include('### Release note\n\n* super release!');

cb();
}, function() {
done();
}));
});
});

0 comments on commit 53a18bc

Please sign in to comment.