Skip to content

Commit

Permalink
fix(parse): default to angular preset for empty parserOpts (#265)
Browse files Browse the repository at this point in the history
Closes #262
  • Loading branch information
marionebl authored Feb 3, 2018
1 parent 2c03ec6 commit ccb03b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion @commitlint/parse/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import defaultChangelogOpts from 'conventional-changelog-angular';
export default parse;

async function parse(message, parser = sync, parserOpts) {
if (!parserOpts) {
if (!parserOpts || Object.keys(parserOpts || {}).length === 0) {
const changelogOpts = await defaultChangelogOpts;
parserOpts = changelogOpts.parserOpts;
}
Expand Down
7 changes: 7 additions & 0 deletions @commitlint/parse/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ test('supports scopes with /', async t => {
t.is(actual.subject, 'subject');
});

test('supports scopes with / and empty parserOpts', async t => {
const message = 'type(some/scope): subject';
const actual = await parse(message, undefined, {});
t.is(actual.scope, 'some/scope');
t.is(actual.subject, 'subject');
});

test('ignores comments', async t => {
const message = 'type(some/scope): subject\n# some comment';
const changelogOpts = await importFrom(
Expand Down

0 comments on commit ccb03b4

Please sign in to comment.