TermAl

Test Plan

This document describes the current TermAl test strategy and the commands used before reviews or releases.

Current State

TermAl has both backend and frontend automated tests.

Backend:

Frontend:

Type/build checks:

Review Gate

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.

Backend Testing Guidelines

Prefer focused Rust tests in src/tests.rs for:

Backend tests should avoid starting real agents. Use test HTTP listeners, temporary directories, injected remote configs, and helper state builders instead.

Frontend Testing Guidelines

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.

Known Coverage Gaps

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:

What Not To Test