Skip to content

Commit

Permalink
Chore commits should map to 'none' type beachball changes
Browse files Browse the repository at this point in the history
  • Loading branch information
asmundg committed Aug 20, 2021
1 parent 23dbb46 commit 83c6dae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/__tests__/changefile/conventionalCommits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { parseConventionalCommit } from '../../changefile/conventionalCommits';

describe.each<[string, ReturnType<typeof parseConventionalCommit>]>([
['fix: change message\nbody', { type: 'patch', message: 'change message' }],
['chore: change', { type: 'patch', message: 'change' }],
['chore: change', { type: 'none', message: 'change' }],
['feat: change', { type: 'minor', message: 'change' }],
['feat(scope): change', { type: 'minor', message: 'change' }],
['feat!: change', { type: 'major', message: 'change' }],
['feat(scope)!: change', { type: 'major', message: 'change' }],
['foo', undefined],
['fix(foo-bar): change', { type: 'patch', message: 'change' }],
])('parse(%s)', (s, expected) => {
test('should parse correctly', () => expect(parseConventionalCommit(s)).toEqual(expected));
});
5 changes: 3 additions & 2 deletions src/changefile/conventionalCommits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ChangeType } from '../types/ChangeInfo';
* 3. breaking
* 4. message
*/
const COMMIT_RE = /([a-z]+)(?:\(([a-z]+)\))?(!)?: (.+)/;
const COMMIT_RE = /([a-z]+)(?:\(([a-z\-]+)\))?(!)?: (.+)/;

interface ConventionalCommit {
type: string;
Expand Down Expand Up @@ -34,8 +34,9 @@ function map(d: ConventionalCommit): Change | undefined {
}

switch (d.type) {
case 'fix':
case 'chore':
return { type: 'none', message: d.message };
case 'fix':
return { type: 'patch', message: d.message };
case 'feat':
return { type: 'minor', message: d.message };
Expand Down

0 comments on commit 83c6dae

Please sign in to comment.