This document describes the current TermAl test strategy and the commands used before reviews or releases.
TermAl has both backend and frontend automated tests.
Backend:
src/tests.rs.scripts/test-rust.sh.Frontend:
*.test.ts and *.test.tsx.App integration harness.cd ui && npx vitest run.Type/build checks:
cargo check.cd ui && npx tsc --noEmit.cd ui && npm run build.Before a code review of staged/unstaged work:
cargo check
cd ui && npx tsc --noEmit
cd .. && node --test scripts/review-freeze-fingerprint.test.mjs scripts/vitest-resource-preflight.test.mjs
If any command reports errors, stop and fix those first. Warnings can be reported and triaged with the review.
For higher-confidence changes, also run:
scripts/test-rust.sh
cd ui && npx vitest run
The Rust wrapper raises the inherited Unix file-descriptor soft limit toward
4096 and defaults libtest to four threads. This prevents FD-heavy SQLite,
HTTP, and runtime fixtures from intermittently exhausting macOS’s common
256-descriptor default. Set TERMAL_TEST_FD_LIMIT or TERMAL_TEST_THREADS to
positive integers to override those defaults; existing RUST_TEST_THREADS is
also honored when TERMAL_TEST_THREADS is unset. Extra arguments are passed
through to cargo test, for example:
scripts/test-rust.sh mailbox_store_tests
The review-integrity helper tests run on Linux, macOS, and Windows in CI. The Vitest resource preflight itself uses three fixed CPU samples and the median, so one scheduler spike does not reject a gate while sustained starvation still fails before frontend tests start. Windows reports process CPU availability without presenting its unsupported load-average value as real system load.
Prefer focused Rust tests in src/tests.rs for:
tower::ServiceExtBackend tests should avoid starting real agents. Use test HTTP listeners, temporary directories, injected remote configs, and helper state builders instead.
Prefer pure TypeScript tests for reducers and helpers:
Use React Testing Library when the regression depends on rendered behavior:
Keep integration tests focused. The main App.test.tsx harness is valuable but
expensive; prefer extracting pure helpers or testing a panel directly when that
captures the bug.
The active follow-up list lives in docs/bugs.md under Implementation Tasks.
Those tasks are not active bugs; they are P2 coverage or type-surface
improvements.
Current gaps:
minAttempts
floor more directlyisScrollContainerAtBottom helper needs either deletion or a
comment explaining why the dead export is intentionalsetAppTestHooksForTests should either be tree-shaken from production or
documented as non-sensitive test-only surfaceAppTestHooks should be exported for cleaner test typingresolveSettledScrollMinimumAttempts(0) needs a small edge assertion~/.termal directory.