diff --git a/src/__tests__/changefile/conventionalCommits.test.ts b/src/__tests__/changefile/conventionalCommits.test.ts index 08a29b782..306b81e7e 100644 --- a/src/__tests__/changefile/conventionalCommits.test.ts +++ b/src/__tests__/changefile/conventionalCommits.test.ts @@ -2,12 +2,13 @@ import { parseConventionalCommit } from '../../changefile/conventionalCommits'; describe.each<[string, ReturnType]>([ ['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)); }); diff --git a/src/changefile/conventionalCommits.ts b/src/changefile/conventionalCommits.ts index 267923494..abc4a6f66 100644 --- a/src/changefile/conventionalCommits.ts +++ b/src/changefile/conventionalCommits.ts @@ -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; @@ -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 };