融合(D5):#969 的图谱引擎作为 Git 镜头内的「提交图」区上线,不再新增第三个镜头。 - 保留:src/git-graph.ts(有界路由 + graph-stale/graph-limit)、graph-layout.ts、 graph.module.css、CommitDetails、DiffPane 的 PaneTabStrip 与 details/content/diff 分签、 hover 卡片、引用徽章、分支筛选、无限滚动、e2e 与设计文档; - 落位:GitGraphLens → GitGraphSection(挂在 GitLens 的 Graph 区,目标读镜头自己的 仓库/worktree 选择,不再自持选择器);行右键接回 #944 的提交菜单(查看/复制/revert/cherry-pick); - 去掉:第三镜头与 changesGraphLens 键、#944 的 GitGraph.tsx(及随之无消费者的 log 行样式与 historyLoadError/changesNoHistory 词典键); - 镜头常驻保留(hidden 切换):Graph 的滚动/选中、Changes 的展开与草稿切走不丢, 同时 store 槽位与轮询按「可见 + 在屏」分别门控(切回不闪 loading); - 两套重写过的测试按新契约对齐(底部面板分签、图谱区与 Git 镜头的关系、图行/历史断言)。
66 lines
2.9 KiB
TypeScript
66 lines
2.9 KiB
TypeScript
import { spawnSync } from 'node:child_process'
|
|
import { mkdtempSync, readFileSync, rmSync } from 'node:fs'
|
|
import { tmpdir } from 'node:os'
|
|
import { join } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { expect, it } from 'vitest'
|
|
|
|
const root = fileURLToPath(new URL('../', import.meta.url)).replaceAll('\\', '/')
|
|
const script = readFileSync(join(root, 'scripts/e2e-aggregate-mount.sh'), 'utf8')
|
|
const hasBash = spawnSync('bash', ['--version'], { stdio: 'ignore' }).status === 0
|
|
|
|
it.skipIf(!hasBash)('exchanges the full aggregate launch URL and authenticates both unchanged API probes', () => {
|
|
const scratch = mkdtempSync(join(tmpdir(), 'dsh-aggregate-auth-')).replaceAll('\\', '/')
|
|
const launch = 'http://127.0.0.1:4199/?token=aggregate-test-token'
|
|
try {
|
|
expect(spawnSync('bash', ['-n', join(root, 'scripts/e2e-aggregate-mount.sh')]).status).toBe(0)
|
|
const start = script.indexOf('E2E_READY_RE=')
|
|
expect(start).toBeGreaterThan(-1)
|
|
const result = spawnSync('bash', ['-c', `
|
|
set -euo pipefail
|
|
E2E_TAG=e2e-aggregate-auth
|
|
source "$ROOT/scripts/e2e-common.sh"
|
|
OUT_LOG="$SCRATCH/out.log"
|
|
ERR_LOG="$SCRATCH/err.log"
|
|
printf 'dsh web: %s (LAN: http://example.invalid:4199)\\n' "$TEST_LAUNCH_URL" > "$OUT_LOG"
|
|
: > "$ERR_LOG"
|
|
SERVER_PID=$$
|
|
curl() {
|
|
printf '%s\\n' "$*" >> "$SCRATCH/curl.log"
|
|
case "\${!#}" in
|
|
"$TEST_LAUNCH_URL") : > "$SCRATCH/auth.cookies" ;;
|
|
*/settings.get) printf '%s' '{"ok":true}' ;;
|
|
*/__e2e_unknown__) printf '404' ;;
|
|
*) return 1 ;;
|
|
esac
|
|
}
|
|
${script.slice(start)}
|
|
`], {
|
|
encoding: 'utf8', timeout: 5_000,
|
|
env: { ...process.env, ROOT: root, SCRATCH: scratch, TEST_LAUNCH_URL: launch },
|
|
})
|
|
expect(result.stderr).toBe('')
|
|
expect(result.status).toBe(0)
|
|
expect(result.stdout).not.toContain('aggregate-test-token')
|
|
const calls = readFileSync(join(scratch, 'curl.log'), 'utf8').trim().split('\n')
|
|
expect(calls).toHaveLength(3)
|
|
expect(calls[0]).toContain(`--cookie-jar ${scratch}/auth.cookies`)
|
|
expect(calls[0]).toContain(launch)
|
|
// No redirect-following flag. Check the FLAGS, never the whole line: the
|
|
// scratch path is a mkdtemp name, and a random suffix can put an `L` right
|
|
// after a `-` (`dsh-aggregate-auth-6mLM51`), which a line-wide regex reads
|
|
// as a `-L` flag (the Windows lane caught exactly that).
|
|
const shortFlags = calls[0]!.split(/\s+/).filter(token => token.startsWith('-') && !token.startsWith('--'))
|
|
expect(shortFlags.some(flag => flag.includes('L'))).toBe(false)
|
|
expect(calls[0]).not.toContain('--location')
|
|
for (const call of calls.slice(1)) {
|
|
expect(call).toContain(`--cookie ${scratch}/auth.cookies`)
|
|
expect(call).toContain('-X POST http://127.0.0.1:4199/sidebar/api/')
|
|
expect(call).not.toContain('?token=')
|
|
}
|
|
expect(result.stdout).toContain('HTTP 404')
|
|
} finally {
|
|
rmSync(scratch, { recursive: true, force: true })
|
|
}
|
|
})
|