diff --git a/lib/analyze-commit.js b/lib/analyze-commit.js index be1572eb..c2d3d056 100644 --- a/lib/analyze-commit.js +++ b/lib/analyze-commit.js @@ -22,9 +22,13 @@ module.exports = (releaseRules, commit) => { // If the rule is not `revert` or the commit is not a revert (!revert || commit.revert) && // Otherwise match the regular rules - isMatchWith(commit, rule, (object, src) => - isString(src) && isString(object) ? micromatch.isMatch(object, src) : undefined - ) + isMatchWith(commit, rule, (object, src) => { + if (src === '*') { + return true; + } + + return isString(src) && isString(object) ? micromatch.isMatch(object, src) : undefined; + }) ) .every((match) => { if (compareReleaseTypes(releaseType, match.release)) { diff --git a/test/analyze-commit.test.js b/test/analyze-commit.test.js index b0aa2c40..5f82bf2b 100644 --- a/test/analyze-commit.test.js +++ b/test/analyze-commit.test.js @@ -85,6 +85,10 @@ test('Match with glob', (t) => { t.is(analyzeCommit(rules, notMatch), undefined); }); +test('Match with catchall and undefined commit', (t) => { + t.is(analyzeCommit([{type: '*', release: 'patch'}], {type: null}), 'patch'); +}); + test('Return highest release type if multiple rules match', (t) => { const commit = { type: 'feat',