🐛 fix(vscode): 摘修复按 Gitea PR 提交列表分组
This commit is contained in:
1 parent
c0f8da5514
commit
4d3b2a0d67
6 files changed
+193
-34
No files matched your search
@@ -12,7 +12,6 @@ import {
|
||||
normalizeReleasePrefix,
|
||||
pickCurrentRelease,
|
||||
todayReleaseBranch,
|
||||
parsePrNumber,
|
||||
groupCommitsByPr,
|
||||
} from '../../src/git/release'
|
||||
|
||||
@@ -58,27 +57,20 @@ describe('纯函数', () => {
|
||||
expect(pickCurrentRelease('release/', ['main', 'release/2026-08-01', 'release/2026-08-31', 'hotfix/2027'])).toBe('release/2026-08-31')
|
||||
expect(pickCurrentRelease('release/', ['main'])).toBeUndefined()
|
||||
})
|
||||
it('parsePrNumber 认 Closes/Fixes/Resolves 和 (#N)', () => {
|
||||
expect(parsePrNumber('feat: x (#390)')).toBe(390)
|
||||
expect(parsePrNumber('fix: y\n\nCloses #12')).toBe(12)
|
||||
expect(parsePrNumber('fix: y\n\nFixes #3')).toBe(3)
|
||||
expect(parsePrNumber('fix: y\n\nResolves #9')).toBe(9)
|
||||
expect(parsePrNumber('feat: no pr')).toBeUndefined()
|
||||
})
|
||||
it('groupCommitsByPr 同 PR 收一组,无 PR 进未关联,保持新→旧', () => {
|
||||
it('groupCommitsByPr 按 Gitea 给的 pr 号分组,说明里没有 Closes 也能归组', () => {
|
||||
const groups = groupCommitsByPr([
|
||||
{ sha: 'a', subject: 'feat: later (#2)', author: 'me', date: '2026-09-01', body: '' },
|
||||
{ sha: 'b', subject: 'fix: earlier', author: 'you', date: '2026-08-31', body: 'Closes #2' },
|
||||
{ sha: '3e519ea', subject: 'fix(admin): 会员档位隐藏', author: 'chehongweo', date: '2026-08-31', body: '', pr: 260, prTitle: '连续包月会员订阅体系' },
|
||||
{ sha: '5572c4f', subject: 'fix(membership): 年付月度发卡', author: 'chehongweo', date: '2026-08-31', body: '', pr: 260, prTitle: '连续包月会员订阅体系' },
|
||||
{ sha: 'c', subject: 'chore: lone', author: 'you', date: '2026-08-30', body: '' },
|
||||
])
|
||||
expect(groups).toEqual([
|
||||
{
|
||||
pr: 2,
|
||||
title: 'feat: later',
|
||||
authors: ['me', 'you'],
|
||||
pr: 260,
|
||||
title: '连续包月会员订阅体系',
|
||||
authors: ['chehongweo'],
|
||||
commits: [
|
||||
{ sha: 'a', subject: 'feat: later (#2)', author: 'me', date: '2026-09-01', body: '' },
|
||||
{ sha: 'b', subject: 'fix: earlier', author: 'you', date: '2026-08-31', body: 'Closes #2' },
|
||||
{ sha: '3e519ea', subject: 'fix(admin): 会员档位隐藏', author: 'chehongweo', date: '2026-08-31', body: '', pr: 260, prTitle: '连续包月会员订阅体系' },
|
||||
{ sha: '5572c4f', subject: 'fix(membership): 年付月度发卡', author: 'chehongweo', date: '2026-08-31', body: '', pr: 260, prTitle: '连续包月会员订阅体系' },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user