docs(contributing): document ui-tui Vitest workflow - #22239
Closed
wesleysimplicio wants to merge 2 commits into
Closed
docs(contributing): document ui-tui Vitest workflow#22239wesleysimplicio wants to merge 2 commits into
wesleysimplicio wants to merge 2 commits into
Conversation
The terminal UI lives in the ui-tui/ workspace package and ships its own TypeScript test suite (Vitest), but CONTRIBUTING.md only mentioned pytest. New contributors editing ui-tui/src/ had no breadcrumb pointing them at the right test runner or where new test files belong. Add a 'TUI tests (Vitest, ui-tui/)' subsection under 'Run tests' that covers: pnpm filter + in-package commands, single-file/-name selection, test file location convention (src/__tests__/*.test.ts), the pure-helper testing pattern already used in textInput and inputMetrics, and the no- console.log house rule.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates contributor documentation to include how to run the ui-tui/ TypeScript test suite (Vitest) alongside the existing Python/pytest guidance, so TUI contributors know the correct test runner, test locations, and conventions.
Changes:
- Add a new “TUI tests (Vitest,
ui-tui/)” subsection under “Run tests”. - Document commands for running the TUI Vitest suite (full run, watch, single file, test-name filtering).
- Document TUI testing conventions (test file location, preference for pure-helper unit tests, and avoiding
console.log).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+124
to
+132
| # From the repo root — pnpm picks up the workspace package automatically | ||
| pnpm --filter @hermes/ui-tui test # one-shot run | ||
| pnpm --filter @hermes/ui-tui test:watch # watch mode while iterating | ||
|
|
||
| # Or from inside the package | ||
| cd ui-tui | ||
| pnpm test # one-shot run | ||
| pnpm vitest run src/__tests__/foo.test.ts # single file | ||
| pnpm vitest run -t "decideRightClickAction" # by test name pattern |
Comment on lines
+140
to
+142
| - Prefer extracting pure helpers (e.g. `cursorLayout`, `lineNav`, | ||
| `decideRightClickAction`) and unit-testing them directly rather than | ||
| rendering the full Ink component. Tests stay fast and don't need a TTY. |
Comment on lines
+137
to
+139
| - Test files live in `ui-tui/src/__tests__/` with the `.test.ts` suffix and | ||
| are auto-discovered by `ui-tui/vitest.config.ts` — no need to register | ||
| them anywhere. |
- Repo uses npm (root has package-lock.json, ui-tui package is named hermes-tui, not @hermes/ui-tui), so the pnpm --filter commands won't work. Replace with npm --prefix / cd ui-tui && npm test equivalents. - vitest.config.ts only sets exclude (no include/testMatch); credit Vitest's default discovery rather than the config. - decideRightClickAction does not exist in the repo; replace example test name pattern with cursorLayout (which is real).
Contributor
Author
|
Closing non-fix PR as requested — mantendo apenas PRs de fix. |
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.
What does this PR do?
The terminal UI lives in the
ui-tui/workspace package and ships its own TypeScript test suite powered by Vitest, butCONTRIBUTING.mdcurrently only coverspytest. New contributors editing files underui-tui/src/have no breadcrumb pointing them at the right test runner, where new test files belong, or what conventions the existing TUI suite uses.Root cause
The detailed rationale from the original PR body is preserved below. This template update keeps the review structure consistent with #29640.
Fix
Add a TUI tests (Vitest,
ui-tui/) subsection right under the existing Run tests section in CONTRIBUTING.md. Covers:pnpm --filter @hermes/ui-tui test) and in-package commands (pnpm test,pnpm vitest run <file>,-t <name>).ui-tui/src/__tests__/*.test.ts, auto-discovered byvitest.config.ts).cursorLayout,lineNav,decideRightClickAction, etc. — preferred over rendering full Ink components.console.login test code.Doc-only change. No code or config touched.
Why this shape
This shape mirrors #29640 so reviewers can quickly compare scope, root cause, fix, tests, and related context without having to decode a custom PR description.
Tests
Original body
Related PRs / issues
Original body
Summary
The terminal UI lives in the
ui-tui/workspace package and ships its own TypeScript test suite powered by Vitest, butCONTRIBUTING.mdcurrently only coverspytest. New contributors editing files underui-tui/src/have no breadcrumb pointing them at the right test runner, where new test files belong, or what conventions the existing TUI suite uses.What Changed
Fluxo
A mudança continua seguindo o fluxo original descrito na seção preservada abaixo, sem ampliar o escopo funcional deste PR.
Visão
A padronização melhora a revisão, reduz ruído e evita deriva de formatação entre PRs abertos.
Test Plan
Original body
Summary
The terminal UI lives in the
ui-tui/workspace package and ships its own TypeScript test suite powered by Vitest, butCONTRIBUTING.mdcurrently only coverspytest. New contributors editing files underui-tui/src/have no breadcrumb pointing them at the right test runner, where new test files belong, or what conventions the existing TUI suite uses.Changes
Add a TUI tests (Vitest,
ui-tui/) subsection right under the existing Run tests section in CONTRIBUTING.md. Covers:pnpm --filter @hermes/ui-tui test) and in-package commands (pnpm test,pnpm vitest run <file>,-t <name>).ui-tui/src/__tests__/*.test.ts, auto-discovered byvitest.config.ts).cursorLayout,lineNav,decideRightClickAction, etc. — preferred over rendering full Ink components.console.login test code.Doc-only change. No code or config touched.
Test plan
Generated by Hermes Turbo
Generated by Hermes Turbo