Skip to content

Commit 29f3527

Browse files
committed
test(cli): own the doctor progress cases in their own file
The end-to-end doctor progress cases landed in `cli-network.test.ts`, which is already past the 1,000-line tripwire, so the test-file-size ratchet rejected the growth. They are doctor-output cases rather than network ones: they move to `cli-doctor-progress.test.ts`, and `cli-network.test.ts` returns to its merge-base size. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Eddu5VC45qAXUkXNZJyruZ
1 parent e4bc1ea commit 29f3527

2 files changed

Lines changed: 60 additions & 38 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { test } from 'vitest';
2+
import assert from 'node:assert/strict';
3+
import { runCliCapture } from './cli-capture.ts';
4+
5+
/**
6+
* The human `doctor` run, end to end over the CLI's own progress wiring: the
7+
* transport hands `command` progress to the sink the CLI installed, which
8+
* renders it to stderr and records that it did, and the output formatter then
9+
* prints the summary alone rather than repeating every check the reader has
10+
* already seen. Without progress it prints the checks.
11+
*/
12+
13+
const DOCTOR_RESULT = {
14+
status: 'pass',
15+
summary: 'No blockers found.',
16+
checks: [
17+
{
18+
id: 'agent-device',
19+
status: 'pass',
20+
summary: 'agent-device 0.17.9 using /tmp/agent-device',
21+
},
22+
{ id: 'device', status: 'warn', summary: 'No booted device.' },
23+
],
24+
};
25+
26+
test('doctor prints only the summary when progress already streamed the checks', async () => {
27+
const result = await runCliCapture(['doctor'], async (_req, options) => {
28+
options?.onProgress?.({
29+
type: 'command',
30+
status: 'progress',
31+
message: '✓ agent-device: agent-device 0.17.9 using /tmp/agent-device',
32+
});
33+
options?.onProgress?.({
34+
type: 'command',
35+
status: 'progress',
36+
message: '! device: No booted device.',
37+
});
38+
return { ok: true, data: DOCTOR_RESULT };
39+
});
40+
41+
assert.equal(result.code, null);
42+
assert.match(
43+
result.stderr,
44+
/✓ agent-device: agent-device 0\.17\.9 using \/tmp\/agent-device\n! device: No booted device\.\n/,
45+
);
46+
assert.match(result.stdout, /Doctor: pass\nNo blockers found\.\n/);
47+
assert.doesNotMatch(result.stdout, /✓ agent-device:/);
48+
});
49+
50+
test('doctor prints the checks when no progress reached stderr', async () => {
51+
const result = await runCliCapture(['doctor'], async () => ({
52+
ok: true,
53+
data: DOCTOR_RESULT,
54+
}));
55+
56+
assert.equal(result.code, null);
57+
assert.equal(result.stderr, '');
58+
assert.match(result.stdout, /✓ agent-device: agent-device 0\.17\.9 using \/tmp\/agent-device/);
59+
assert.match(result.stdout, /! device: No booted device\./);
60+
});

‎src/__tests__/cli-network.test.ts‎

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -189,44 +189,6 @@ test('doctor command opts into progress rows for human output', async () => {
189189
assert.match(result.stdout, /✓ agent-device: agent-device 0\.17\.9 using \/tmp\/agent-device/);
190190
});
191191

192-
test('doctor prints only the summary when progress already streamed the checks', async () => {
193-
const result = await runCliCapture(['doctor'], async (_req, options) => {
194-
options?.onProgress?.({
195-
type: 'command',
196-
status: 'progress',
197-
message: '✓ agent-device: agent-device 0.17.9 using /tmp/agent-device',
198-
});
199-
options?.onProgress?.({
200-
type: 'command',
201-
status: 'progress',
202-
message: '! device: No booted device.',
203-
});
204-
return {
205-
ok: true,
206-
data: {
207-
status: 'pass',
208-
summary: 'No blockers found.',
209-
checks: [
210-
{
211-
id: 'agent-device',
212-
status: 'pass',
213-
summary: 'agent-device 0.17.9 using /tmp/agent-device',
214-
},
215-
{ id: 'device', status: 'warn', summary: 'No booted device.' },
216-
],
217-
},
218-
};
219-
});
220-
221-
assert.equal(result.code, null);
222-
assert.match(
223-
result.stderr,
224-
/✓ agent-device: agent-device 0\.17\.9 using \/tmp\/agent-device\n! device: No booted device\.\n/,
225-
);
226-
assert.match(result.stdout, /Doctor: pass\nNo blockers found\.\n/);
227-
assert.doesNotMatch(result.stdout, /✓ agent-device:/);
228-
});
229-
230192
test('doctor command keeps json output non-streaming', async () => {
231193
const result = await runCliCapture(['doctor', '--json'], async () => ({
232194
ok: true,

0 commit comments

Comments
 (0)