inspector/clients/cli/__tests__
Repository files (latest commit first)
Filename Latest commit message Latest commit date
cliffhall 9117f633aa fix: address Copilot review round 17 on #2248
Four of the five findings share one root cause: the tri-state `outcome`
added in round 15 was not propagated to consumers, which kept branching
on `ok` — true for an `incomplete` report, since nothing that was checked
was wrong.

- CLI `summarizeSkillVerification` counts off `outcome`, not `ok`, so a
  truncated walk no longer prints "no conformance errors" one line before
  exiting SKILL_INCOMPLETE. A mixed failed/incomplete catalog reports
  both counts rather than letting the louder verdict hide the quieter.
- `verifySkills` sets the truncation reason only when entries were
  actually left unread. A file crossing the byte budget as the FINAL
  entry stopped nothing, and "Stopped after 3 of 3" both read as a
  contradiction and demoted a fully-read skill out of `verified`.
- The TUI status line switches on `outcome` through a `Record` over the
  union, so the INCOMPLETE arm is reachable and a fourth outcome would
  be a type error rather than a silently missing label.
- The `incomplete` doc paragraph said it makes `ok` false. It does not,
  deliberately — corrected, and it now names `outcome` as the thing a
  consumer must branch on.
- The web sidebar composes in the per-URI `duplicate-name` warning, so
  two colliding skills are badged in the catalog instead of looking
  clean until one is selected.

The suppressed `selfAttempted` finding is stale — fixed in round 16.

The existing TUI INCOMPLETE test was passing for the wrong reason: its
fixture understated every size, which is itself a mismatch, so the report
was `failed` and only the old `ok`-first branch printed INCOMPLETE. It is
rebuilt with honest digests and sizes, so truncation comes from the
declared-size prefilter and the report is genuinely incomplete.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ND46Ci64DC3tzBy9aG81Nc
Signed-off-by: cliffhall <cliff@futurescale.com>
2026-09-07 23:12:28 -04:00
..
helpers fix(cli): apply a server's persisted mcp.json metadata 2026-08-24 19:32:23 -04:00
app-info.test.ts cli: Wave 3 — programmatic review path (rollup of #1573–#1575) (#1655) 2026-07-11 22:14:23 -04:00
clear-stored-auth-for-relogin.test.ts test(auth): stub the clock in both floor regression tests 2026-09-05 02:00:08 -04:00
cli-oauth-navigation.test.ts CLI: catalog listing, auth flags, and OAuth browser UX (#1782) 2026-07-26 16:55:25 -04:00
cli.test.ts test(proxy): isolate proxy env per file; word the guard failure by candidate source 2026-08-23 23:00:28 -04:00
cliOAuth.test.ts test(cli,tui): typecheck the __tests__ dirs (#1791) (#1799) 2026-07-27 12:05:35 -04:00
e2e.test.ts test(cli,tui): add in-process source coverage gates (#1484) (#1502) 2026-06-20 15:05:58 -04:00
emit-result.test.ts CLI: catalog listing, auth flags, and OAuth browser UX (#1782) 2026-07-26 16:55:25 -04:00
error-handler.test.ts fix: walk contentSchema, await the error envelope, correct the README claim 2026-08-25 03:26:39 -04:00
format-json.test.ts cli: Wave 3 — programmatic review path (rollup of #1573–#1575) (#1655) 2026-07-11 22:14:23 -04:00
format-output.test.ts CLI: catalog listing, auth flags, and OAuth browser UX (#1782) 2026-07-26 16:55:25 -04:00
headers.test.ts feat: port CLI, TUI, and launcher from v1.5 into v2 (#1452) 2026-06-14 20:27:49 -04:00
metadata.test.ts fix(cli): apply a server's persisted mcp.json metadata 2026-08-24 19:32:23 -04:00
method-types.test.ts feat: allow complex JSON values in request _meta 2026-08-23 12:23:40 -04:00
methods.test.ts CLI: catalog listing, auth flags, and OAuth browser UX (#1782) 2026-07-26 16:55:25 -04:00
oauth-interactive.test.ts test(cli,tui): typecheck the __tests__ dirs (#1791) (#1799) 2026-07-27 12:05:35 -04:00
oauth-runner.test.ts Guided-auth removal, OAuth smoke testing, and TUI/CLI support (#1531) 2026-06-29 15:35:51 -04:00
open-url.test.ts CLI: catalog listing, auth flags, and OAuth browser UX (#1782) 2026-07-26 16:55:25 -04:00
programmatic-ergonomics.test.ts feat: allow complex JSON values in request _meta 2026-08-23 12:23:40 -04:00
README.md CLI: catalog listing, auth flags, and OAuth browser UX (#1782) 2026-07-26 16:55:25 -04:00
relogin-revocation.test.ts fix(auth): refuse a grant whose authorization server cannot be established (#2144) 2026-08-28 06:18:58 -04:00
run-method-mocks.test.ts CLI: catalog listing, auth flags, and OAuth browser UX (#1782) 2026-07-26 16:55:25 -04:00
run-method-skills.test.ts fix: address Copilot review round 17 on #2248 2026-09-07 23:12:28 -04:00
run-method.test.ts fix: invoke the registered SIGINT listener directly in run-method.test instead of emitting a process-wide signal 2026-08-12 08:57:35 -07:00
schema-lint-report.test.ts fix: scan only subschema positions, await stderr, show the whole report 2026-08-25 03:10:37 -04:00
servers-list.test.ts fix: redact secrets nested inside metadata in servers/show 2026-08-23 14:03:40 -04:00
skills-verify-cli.test.ts fix: address Copilot review round 15 on #2248 2026-09-07 22:47:32 -04:00
stored-auth.test.ts fix(auth): cover the CLI refresh path and tighten the well-known match 2026-08-28 01:11:51 -04:00
style.test.ts CLI: catalog listing, auth flags, and OAuth browser UX (#1782) 2026-07-26 16:55:25 -04:00
tools.test.ts cli: Wave 3 — programmatic review path (rollup of #1573–#1575) (#1655) 2026-07-11 22:14:23 -04:00

CLI Tests

Tests live under __tests__/ and run via Vitest.

  • Most tests import runCli() in-process (see helpers/cli-runner.ts) so clients/cli/src is measured under the coverage gate. Suite-wide helpers/mock-open-url.ts (vitest setupFiles) mocks open-url so an armed interactive OAuth path cannot launch a real browser.
  • e2e.test.ts (and root scripts/smoke-cli.mjs) spawn the built binary for shebang / process.exit paths — pretest builds test-servers + the CLI bundle first.

Scripts (from clients/cli/)

npm test                  # pretest build + all tests
npm run test:cli          # subset: cli.test.ts
npm run test:cli-tools    # subset: tools.test.ts
npm run test:cli-headers  # subset: headers.test.ts
npm run test:cli-metadata # subset: metadata.test.ts
npm run test:coverage     # build + ≥90 per-file coverage gate
npm run validate          # format:check && lint && typecheck && test

Test files

File Focus
cli.test.ts Core connect / method / config matrix
tools.test.ts tools/call argument coercion
headers.test.ts --header merging
metadata.test.ts --metadata / --tool-metadata
methods.test.ts Method allow-list / rejection
app-info.test.ts --app-info probe paths
format-json.test.ts --format json envelopes
format-output.test.ts Text/json writers
emit-result.test.ts Result emission helpers
method-types.test.ts ONE_SHOT_METHODS / guards
run-method.test.ts Handler dispatch against a real test server
run-method-mocks.test.ts Handler edge cases with mocks
servers-list.test.ts servers/list / servers/show + redaction
cliOAuth.test.ts Connect / mid-RPC OAuth recovery
cli-oauth-navigation.test.ts OSC 8, arm/disarm, MCP_AUTO_OPEN_ENABLED
open-url.test.ts open package wrapper
oauth-runner.test.ts Runner client-config / CIMD flags
oauth-interactive.test.ts Loopback callback OAuth (in-process)
stored-auth.test.ts --use-stored-auth / handoff / wait
clear-stored-auth-for-relogin.test.ts Dual-key --relogin clear
programmatic-ergonomics.test.ts Flag conflicts, timeouts, ergonomics
error-handler.test.ts Exit codes / error shaping
style.test.ts ANSI / OSC 8 helpers
e2e.test.ts Out-of-process binary smoke
helpers/assertions.test.ts Assertion helpers

Helpers

Helper Role
helpers/cli-runner.ts In-process runCli with stdout/stderr capture
helpers/mock-open-url.ts Suite-wide open-url mock (vitest setupFiles)
helpers/assertions.ts expectCliSuccess / expectCliFailure / output matchers
helpers/fixtures.ts Temp config / client.json factories

OAuth interactive tests stub or drive the loopback callback in-process rather than requiring a real browser.