Skip to content

feat(reporters): add accessible text status labels to the terminal reporter - #340

Open
dchaudhari7177 wants to merge 1 commit into
KryptosAI:mainfrom
dchaudhari7177:feat/accessible-status-labels
Open

feat(reporters): add accessible text status labels to the terminal reporter#340
dchaudhari7177 wants to merge 1 commit into
KryptosAI:mainfrom
dchaudhari7177:feat/accessible-status-labels

Conversation

@dchaudhari7177

Copy link
Copy Markdown

Closes #233. Part of #217 — this is the reporter half; the --accessible CLI flag that calls the setter belongs to that parent issue.

What

Screen readers either skip the Unicode status glyphs or announce them by character name ("check mark", "heavy multiplication x"), neither of which conveys status. Colour-blind users relying on glyph shape hit the same wall when colour is the only other signal.

  • setAccessibleMode(v) / isAccessibleMode() exported from src/reporters/terminal.ts, default off.
  • Every status glyph now goes through a single sym() lookup against a SYMBOLS / ACCESSIBLE_SYMBOLS pair, so there is one place to add a symbol and no way to miss a call site:
glyph accessible
[PASS]
[FAIL]
[WARN]
[SKIP]
[INFO]
(bullet) >
  • Colour is untouched — the same ANSI codes are emitted in both modes, asserted by a test.

Call sites covered: watchStatusIcon, renderWatchNoChanges, renderWatchChanges, renderWatchFirstRun (via the icon helper), renderNextActions, and the "What Was Not Tested" / security-diagnostic lines in renderRunTerminal. No raw glyph literals remain outside the symbol table.

One judgement call

The issue lists ❯ → >. There is no in the file; there is , used in two distinct roles:

  • leading bullet ( → Auto-enforce: …) — swapped to >, since that is the marker the issue means.
  • status transition (tools: pass → fail) — left alone. It is prose inside a sentence, not a status symbol, and it reads correctly ("pass to fail"); pass -> fail would be worse. There's a test pinning both halves of this so the intent isn't lost.

Happy to swap the transition arrow too if you'd rather have it uniform.

Tests

tests/reporters-accessible.test.ts (new, 7 tests): default-off, glyphs preserved when off, every status glyph replaced when on, [SKIP] for skipped/unsupported, reversibility, ANSI codes identical across modes, and the bullet-vs-transition arrow distinction above.

All 7 fail with src/reporters/terminal.ts reverted to main, and pass with it.

Checks run locally

gate before after
vitest run 60 failed, 537 passed (63 files) 60 failed, 544 passed (64 files)
npm run typecheck pass pass
npm run lint TypeError: Cannot read properties of undefined (reading 'Cjs') same

The 60 failures and the lint crash are identical on pristine main on my machine — this PR adds 7 passing tests and changes nothing else.

Heads-up on the documented install

npm install as written in CONTRIBUTING fails here with ERESOLVE: the root pins typescript@7.0.2 (dev) while @typescript-eslint/eslint-plugin@8.64.0ts-api-utils@^2.5.0 resolves against it in a way npm rejects. npm ci fails the same way. I got a working tree with npm install --legacy-peer-deps, which is almost certainly why npm run lint then crashes inside @typescript-eslint/typescript-estree. Might be worth a separate issue — I didn't touch dependencies here.

…porter

Screen readers either skip the Unicode status glyphs the terminal reporter
uses or announce them by character name ("check mark", "heavy multiplication
x"), neither of which conveys the status. Colour-blind users relying on the
glyph shape have the same problem when colour is the only other signal.

Add `setAccessibleMode()` / `isAccessibleMode()` and route every status glyph
through a `sym()` lookup, so accessible mode renders [PASS], [FAIL], [WARN],
[SKIP], [INFO] and an ASCII ">" bullet instead of the glyphs. Colour is
orthogonal and is emitted unchanged in both modes.

The "from -> to" arrow in a status-transition message is left as-is: it is
prose inside a sentence rather than a status symbol, and reads correctly.

Part of KryptosAI#217; the CLI flag that calls the setter is that issue's scope.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace Unicode symbols with [PASS]/[FAIL]/[WARN] text labels in terminal reporter when --accessible is set

1 participant