feat(reporters): add accessible text status labels to the terminal reporter - #340
Open
dchaudhari7177 wants to merge 1 commit into
Open
feat(reporters): add accessible text status labels to the terminal reporter#340dchaudhari7177 wants to merge 1 commit into
dchaudhari7177 wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #233. Part of #217 — this is the reporter half; the
--accessibleCLI 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 fromsrc/reporters/terminal.ts, default off.sym()lookup against aSYMBOLS/ACCESSIBLE_SYMBOLSpair, so there is one place to add a symbol and no way to miss a call site:✓[PASS]✗[FAIL]⚠[WARN]–[SKIP]ℹ[INFO]→(bullet)>Call sites covered:
watchStatusIcon,renderWatchNoChanges,renderWatchChanges,renderWatchFirstRun(via the icon helper),renderNextActions, and the "What Was Not Tested" / security-diagnostic lines inrenderRunTerminal. 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:→ Auto-enforce: …) — swapped to>, since that is the marker the issue means.tools: pass → fail) — left alone. It is prose inside a sentence, not a status symbol, and it reads correctly ("pass to fail");pass -> failwould 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.tsreverted tomain, and pass with it.Checks run locally
vitest runnpm run typechecknpm run lintTypeError: Cannot read properties of undefined (reading 'Cjs')The 60 failures and the lint crash are identical on pristine
mainon my machine — this PR adds 7 passing tests and changes nothing else.Heads-up on the documented install
npm installas written in CONTRIBUTING fails here withERESOLVE: the root pinstypescript@7.0.2(dev) while@typescript-eslint/eslint-plugin@8.64.0→ts-api-utils@^2.5.0resolves against it in a way npm rejects.npm cifails the same way. I got a working tree withnpm install --legacy-peer-deps, which is almost certainly whynpm run lintthen crashes inside@typescript-eslint/typescript-estree. Might be worth a separate issue — I didn't touch dependencies here.