test(tui): stabilize snapshot workspace width

This commit is contained in:
Tianyi Cui
2026-07-19 01:42:16 +08:00
parent e68cef1be1
commit 81ca81e23d
8 changed files with 52 additions and 49 deletions

View File

@@ -67,6 +67,7 @@ buffer
style 1-1 inverse
28| "────────────────────────────────────────────────────────────────────────────────────────────────────"
style 0-99 dim
29| "/workspace/project ↑3.0k ↓"
style 0-99 dim
29| "/workspace/project ↑3.0k ↓115 idle reasoning:on tools:compact"
style 0-58 dim
style 67-99 dim
30-35| <blank>

View File

@@ -73,7 +73,7 @@ buffer
style 1-1 inverse
30| "────────────────────────────────────────────────────────────────────────────────────────────────────"
style 0-99 dim
31| "/workspace/project ↑3.1k ↓158 idle"
style 0-93 dim
style 96-99 dim
31| "/workspace/project ↑3.1k ↓158 idle reasoning:on tools:compact"
style 0-49 dim
style 67-99 dim
32-35| <blank>

View File

@@ -111,5 +111,6 @@ buffer
style 1-1 inverse
48| "────────────────────────────────────────────────────────────────────────────────────────────────────"
style 0-99 dim
49| "/workspace/project ↑"
style 0-99 dim
49| "/workspace/project ↑18 ↓18 idle reasoning:on tools:compact"
style 0-61 dim
style 67-99 dim

View File

@@ -101,5 +101,6 @@ buffer
style 1-1 inverse
45| "────────────────────────────────────────────────────────────────────────────────────────────────────"
style 0-99 dim
46| "/workspace/project ↑3.5k ↓22"
style 0-99 dim
46| "/workspace/project ↑3.5k ↓227 idle reasoning:on tools:compact"
style 0-56 dim
style 67-99 dim

View File

@@ -64,6 +64,7 @@ buffer
style 1-1 inverse
29| "────────────────────────────────────────────────────────────────────────────────────────────────────"
style 0-99 dim
30| "/workspace/project ↑2"
style 0-99 dim
30| "/workspace/project ↑2.9k ↓41 idle reasoning:on tools:compact"
style 0-62 dim
style 67-99 dim
31-35| <blank>

View File

@@ -1,7 +1,7 @@
terminal 100x36 buffer=normal length=41 base=5 viewport=5
terminal 100x36 buffer=normal length=39 base=3 viewport=3
lifecycle started=1 stopped=0 progress=inactive
title "DSH TUI snapshot"
cursor hidden column=1 viewportRow=33 bufferRow=38
cursor hidden column=1 viewportRow=33 bufferRow=36
buffer
0| "╭──────────────────────────────────────────────────────────────────────────────────────────────────╮"
style 0-99 fg=bright-blue
@@ -37,58 +37,55 @@ buffer
style 0-0 fg=green
style 2-2 fg=green bold
style 3-13 bold
13| "▌ <path>/workspace/project"
13| "▌ <path>/workspace/project/a.txt</path> "
style 0-0 fg=green
14| "▌ /a.txt</path> "
14| "▌ <type>file</type> "
style 0-0 fg=green
15| "▌ <type>file</type> "
15| "▌ <content> "
style 0-0 fg=green
16| "▌ <content> "
16| "▌ 1: alpha "
style 0-0 fg=green
17| "▌ 1: alpha "
17| "▌ "
style 0-0 fg=green
18| "▌ "
18| "▌ (End of file - total 1 lines) "
style 0-0 fg=green
19| "▌ (End of file - total 1 lines) "
19| "▌ </content> "
style 0-0 fg=green
20| "▌ </content> "
20| "▌ "
style 0-0 fg=green
21| "▌ "
21| <blank>
22| "▌ "
style 0-0 fg=green
22| <blank>
23| "▌ "
style 0-0 fg=green
24| "▌ ✓ Read b.txt "
23| "▌ ✓ Read b.txt "
style 0-0 fg=green
style 2-2 fg=green bold
style 3-13 bold
25| "▌ <path>/workspace/project"
24| "▌ <path>/workspace/project/b.txt</path> "
style 0-0 fg=green
26| "▌ /b.txt</path> "
25| "▌ <type>file</type> "
style 0-0 fg=green
27| "▌ <type>file</type> "
26| "▌ <content> "
style 0-0 fg=green
28| "▌ <content> "
27| "▌ 1: beta "
style 0-0 fg=green
29| "▌ 1: beta "
28| "▌ "
style 0-0 fg=green
30| "▌ "
29| "▌ (End of file - total 1 lines) "
style 0-0 fg=green
31| "▌ (End of file - total 1 lines) "
30| "▌ </content> "
style 0-0 fg=green
32| "▌ </content> "
31| "▌ "
style 0-0 fg=green
33| "▌ "
style 0-0 fg=green
34| <blank>
35| " Assistant "
32| <blank>
33| " Assistant "
style 1-9 fg=bright-magenta bold
36| " DONE "
34| " DONE "
35| "────────────────────────────────────────────────────────────────────────────────────────────────────"
style 0-99 dim
36| " "
style 1-1 inverse
37| "────────────────────────────────────────────────────────────────────────────────────────────────────"
style 0-99 dim
38| " "
style 1-1 inverse
39| "────────────────────────────────────────────────────────────────────────────────────────────────────"
style 0-99 dim
40| "/workspace/project ↑20 ↓6"
style 0-99 dim
38| "/workspace/project ↑20 ↓6 idle reasoning:on tools:compact"
style 0-55 dim
style 67-99 dim

View File

@@ -76,6 +76,6 @@ buffer
style 1-1 inverse
34| "────────────────────────────────────────────────────────────────────────────────────────────────────"
style 0-99 dim
35| "/workspace/project ↑3.1k ↓145 idle"
style 0-93 dim
style 96-99 dim
35| "/workspace/project ↑3.1k ↓145 idle reasoning:on tools:compact"
style 0-49 dim
style 67-99 dim

View File

@@ -28,6 +28,8 @@ import WorkerWorkflowEngine from '@deepseek-ai/dsh-workflow-workerthread'
import { HeadlessTerminal } from '../../../packages/ui/tui/tests/headless-terminal.ts'
const SNAPSHOTS_DIR = join(dirname(fileURLToPath(import.meta.url)), 'snapshots')
// Keep pre-normalization layout widths identical across macOS and Linux.
const SNAPSHOT_TMP_ROOT = process.platform === 'win32' ? tmpdir() : '/tmp'
const PROVIDERS = [{ id: 'deepseek', models: [{ id: 'deepseek-v4-flash' }] }]
const UUID_RE = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi
@@ -204,7 +206,7 @@ async function runScenario(scenario: Scenario): Promise<ScenarioResult> {
const prompts = userPrompts(fixture)
expect(prompts.length, `${scenario.name} must carry at least one recorded user prompt`).toBeGreaterThan(0)
const cwd = await mkdtemp(join(tmpdir(), `dsh-tui-snapshot-${scenario.name}-`))
const cwd = await mkdtemp(join(SNAPSHOT_TMP_ROOT, `dsh-tui-snapshot-${scenario.name}-`))
let ctx: Context | undefined
let controller: ReturnType<typeof createTuiChat> | undefined
const terminal = new HeadlessTerminal(100, 36)