🐛 fix(vscode): worktree 复用测试在 macOS 上按真实路径比较,顺手清掉旧的代码风格错误

Claude-Session: https://claude.ai/code/session_01KDcq9HcrVLs2c9tkRxasub
This commit is contained in:
cruldra committed 2026-09-03 05:43:01 +08:00
1 parent ae875756a9
commit f4b1d80105
5 files changed
+12 -10

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
"publisher": "clurdra",
"name": "superpowers-vscode-clurdra",
"displayName": "Superpowers-clurdra",
"version": "0.2.117",
"version": "0.2.118",
"packageManager": "pnpm@10.27.0",
"description": "Superpowers specs and plans Kanban explorer",
"author": "clurdra",
+1 -1
View File
@@ -268,7 +268,7 @@ export async function listUnreleasedCommits(o: { cwd: string, devBranch: string,
)
if (!out)
return []
const commits = out.split('\x1e').flatMap((chunk) => {
const commits = out.split('\x1E').flatMap((chunk) => {
const trimmed = chunk.replace(/^\n+/, '').trimEnd()
if (!trimmed)
return []
+5 -5
View File
@@ -7,14 +7,14 @@ import {
cherryPickToRelease,
cutRelease,
getReleaseStatus,
groupCommitsByPr,
indexUnreleasedByMergePr,
listReleaseBranches,
listUnreleasedCommits,
normalizeReleasePrefix,
parseGiteaMergeSubject,
pickCurrentRelease,
todayReleaseBranch,
groupCommitsByPr,
parseGiteaMergeSubject,
indexUnreleasedByMergePr,
} from '../../src/git/release'
const gitEnv = { ...process.env, GIT_CONFIG_NOSYSTEM: '1', GIT_CONFIG_GLOBAL: '/dev/null', GIT_TERMINAL_PROMPT: '0', GIT_AUTHOR_NAME: 't', GIT_AUTHOR_EMAIL: 't@t', GIT_COMMITTER_NAME: 't', GIT_COMMITTER_EMAIL: 't@t' }
@@ -60,7 +60,7 @@ describe('纯函数', () => {
expect(pickCurrentRelease('release/', ['main'])).toBeUndefined()
})
it('parseGiteaMergeSubject 认 Gitea 合并说明', () => {
expect(parseGiteaMergeSubject("Merge pull request '连续包月会员订阅体系' (#260) from feature/monthly-membership into main")).toEqual({
expect(parseGiteaMergeSubject('Merge pull request \'连续包月会员订阅体系\' (#260) from feature/monthly-membership into main')).toEqual({
number: 260,
title: '连续包月会员订阅体系',
})
@@ -135,7 +135,7 @@ describe('集成', () => {
const a = commit(fx.peer, 'b.txt', 'b', 'fix(admin): 会员档位隐藏')
const b = commit(fx.peer, 'c.txt', 'c', 'fix(membership): 年付月度发卡')
git(fx.peer, ['checkout', 'main'])
git(fx.peer, ['merge', '--no-ff', '-m', "Merge pull request '连续包月会员订阅体系' (#260) from feature into main", 'feature'])
git(fx.peer, ['merge', '--no-ff', '-m', 'Merge pull request \'连续包月会员订阅体系\' (#260) from feature into main', 'feature'])
git(fx.peer, ['push', 'origin', 'main'])
git(fx.repo, ['fetch', 'origin'])
const map = await indexUnreleasedByMergePr({
+4 -2
View File
@@ -1,5 +1,5 @@
import { execFileSync } from 'node:child_process'
import { existsSync, promises as fsp, rmSync, writeFileSync } from 'node:fs'
import { existsSync, promises as fsp, realpathSync, rmSync, writeFileSync } from 'node:fs'
import * as os from 'node:os'
import * as path from 'node:path'
import { afterEach, describe, expect, it } from 'vitest'
@@ -24,7 +24,9 @@ interface Fixture { root: string, origin: string, repo: string, templatePath: st
/** origin(bare)← 同事的 clone push feature 分支;repo 是接管方的 clone,只有 main。 */
async function setup(): Promise<Fixture> {
const root = await fsp.mkdtemp(path.join(os.tmpdir(), 'sw-remote-'))
// macOS 的 tmpdir 是 /var → /private/var 的软链,git worktree list 报的是真实路径;
// 夹具根目录先取真实路径,复用分支返回的路径才能和模板路径按字符串相等。
const root = realpathSync(await fsp.mkdtemp(path.join(os.tmpdir(), 'sw-remote-')))
const origin = path.join(root, 'origin.git')
git(root, ['init', '--bare', '-b', 'main', origin])
const peer = path.join(root, 'peer')
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import type { ReleaseCommitGroup } from './messages'
import { describe, expect, it } from 'vitest'
import { filterCherryPickGroups, uniqueAuthors } from './cherryPickView'
const groups: ReleaseCommitGroup[] = [