|
| 1 | +# Test layout |
| 2 | + |
| 3 | +Most Hunk tests are colocated in `src/` beside the code they cover. |
| 4 | + |
| 5 | +The top-level `test/` tree is reserved for cases that intentionally exercise the product across module, process, repo, or terminal boundaries. |
| 6 | + |
| 7 | +## Structure |
| 8 | + |
| 9 | +```text |
| 10 | +test/ |
| 11 | + helpers/ shared unit-test fixtures |
| 12 | + cli/ black-box CLI contracts |
| 13 | + session/ daemon, broker, and session-CLI flows |
| 14 | + pty/ live PTY-driven UI integration |
| 15 | + smoke/ thin terminal transcript sanity checks |
| 16 | +``` |
| 17 | + |
| 18 | +## What lives here |
| 19 | + |
| 20 | +- `test/helpers/` — shared test-only builders and fixtures reused by colocated unit tests. |
| 21 | +- `test/cli/` — black-box CLI contract tests that spawn the real entrypoint and assert help, version, pager fallback, and friendly error output. |
| 22 | +- `test/session/` — daemon, broker, and session-CLI coverage. These tests often start subprocesses, create temp repos/files, and verify cross-process behavior. |
| 23 | +- `test/pty/` — PTY-backed live UI integration tests for resize, navigation, mouse input, layout changes, and note visibility. |
| 24 | +- `test/smoke/` — opt-in terminal transcript smoke coverage for real TTY rendering (`bun run test:tty-smoke`). |
| 25 | + |
| 26 | +## Why these are not colocated |
| 27 | + |
| 28 | +These tests do not belong to a single source file. They usually verify product-level behavior such as: |
| 29 | + |
| 30 | +- command-line contracts |
| 31 | +- subprocess and daemon lifecycle |
| 32 | +- live session brokering |
| 33 | +- PTY / terminal rendering behavior |
| 34 | +- full review-flow interactions across multiple modules |
| 35 | + |
| 36 | +If a test mainly targets one module or helper, keep it colocated in `src/`. |
| 37 | +If it needs a real repo, subprocess, daemon, PTY, or transcript-level assertion, it likely belongs under `test/`. |
0 commit comments