Skip to content

docs(contributing): document ui-tui Vitest workflow - #22239

Closed
wesleysimplicio wants to merge 2 commits into
NousResearch:mainfrom
wesleysimplicio:docs/contributing-ui-tui-vitest
Closed

docs(contributing): document ui-tui Vitest workflow#22239
wesleysimplicio wants to merge 2 commits into
NousResearch:mainfrom
wesleysimplicio:docs/contributing-ui-tui-vitest

Conversation

@wesleysimplicio

@wesleysimplicio wesleysimplicio commented May 9, 2026

Copy link
Copy Markdown
Contributor

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, but CONTRIBUTING.md currently only covers pytest. New contributors editing files under ui-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 workspace filter (pnpm --filter @hermes/ui-tui test) and in-package commands (pnpm test, pnpm vitest run <file>, -t <name>).
  • Test file location convention (ui-tui/src/__tests__/*.test.ts, auto-discovered by vitest.config.ts).
  • The pure-helper testing pattern already used by cursorLayout, lineNav, decideRightClickAction, etc. — preferred over rendering full Ink components.
  • House rule: no console.log in 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

  • Veja a descrição original preservada abaixo para detalhes de validação, testes e notas de verificação.
Original body

Related PRs / issues

  • Original body preserved below for full context.
Original body

Summary

The terminal UI lives in the ui-tui/ workspace package and ships its own TypeScript test suite powered by Vitest, but CONTRIBUTING.md currently only covers pytest. New contributors editing files under ui-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

  • Standardized this PR body to the current Hermes Turbo template.
  • Preserved the original detailed description below for reference.

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

  • Veja a descrição original preservada abaixo para detalhes de validação, testes e notas de verificação.
Original body

Summary

The terminal UI lives in the ui-tui/ workspace package and ships its own TypeScript test suite powered by Vitest, but CONTRIBUTING.md currently only covers pytest. New contributors editing files under ui-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 workspace filter (pnpm --filter @hermes/ui-tui test) and in-package commands (pnpm test, pnpm vitest run <file>, -t <name>).
  • Test file location convention (ui-tui/src/__tests__/*.test.ts, auto-discovered by vitest.config.ts).
  • The pure-helper testing pattern already used by cursorLayout, lineNav, decideRightClickAction, etc. — preferred over rendering full Ink components.
  • House rule: no console.log in test code.

Doc-only change. No code or config touched.

Test plan

  • N/A — markdown-only change. Renders correctly on GitHub preview.

Generated by Hermes Turbo


Generated by Hermes Turbo

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.
Copilot AI review requested due to automatic review settings May 9, 2026 03:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread CONTRIBUTING.md Outdated
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 thread CONTRIBUTING.md Outdated
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 thread CONTRIBUTING.md Outdated
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.
@alt-glitch alt-glitch added type/docs Documentation improvements comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have labels May 9, 2026
- 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).
@wesleysimplicio

Copy link
Copy Markdown
Contributor Author

Closing non-fix PR as requested — mantendo apenas PRs de fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have type/docs Documentation improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants