Testing
τ-mux ships three test suites and a design-report pipeline.
Unit / integration
Section titled “Unit / integration”bun test # ~9 s, 800+ tests across 50+ filesbun run typecheckCoverage:
ps/lsof/ sideband parsers (pure-function tests, no subprocesses).- PTY manager.
- RPC handlers (every domain).
- Pane layout (binary-tree split math).
- Web-client reducer + view modules (DOM via
happy-dom). - Native sidebar notification lifecycle.
- Agent panel sub-modules.
- SurfaceManager smoke suite.
- Shared sound helper.
- Telegram db / service / settings / forwarder.
bunfig.toml scopes bare bun test to tests/ only — tests-e2e/ Playwright specs are not picked up.
Web e2e
Section titled “Web e2e”bun run test:e2e # ~1 min, 43 Playwright specsEach spec spawns an isolated WebServer in a Bun subprocess via tests-e2e/server-boot.ts so workers don’t share state. Coverage:
- Auth — open access, query-string token,
Authorization: Bearer, wrong-token 401. - Origin validation — same-host upgrade 101, cross-origin upgrade 403 even with a valid token.
- Terminal round-trip — browser loads the page, xterm renders, keystrokes reach the shell, stdout appears in the DOM.
- Resilience — stdin size cap doesn’t kill the connection, resize clamping doesn’t either,
?resume=<id>&seq=<n>replays buffered output after a disconnect, unknown resume ids fall back to a freshhello.
Playwright targets Chromium only — add Firefox/WebKit under projects: in playwright.config.ts for wider coverage.
Native e2e
Section titled “Native e2e”bun run test:native # full native suitebun run test:native:bloom-on # with WebGL bloom enabledbun run test:native:packaged # against the packaged .appbun run test:native:design-reviewDrives the Electrobun webview directly via Playwright’s connection-over-CDP path. Useful for visual regressions and shortcut-handling tests that the web mirror can’t catch.
Design report
Section titled “Design report”A custom pipeline that captures screenshots from a curated set of routes and diffs them against baselines.
bun run report:design:web # web mirror only (fast)bun run test:full-suite # web + native + design gatebun run baseline:design # promote current screenshots to baselineOutput lives at test-results/design-report/index.html. The --gate form fails CI if any screenshot exceeds the configured pixel-diff threshold.
GitHub Actions (.github/workflows/ci.yml) runs typecheck + bun test and Playwright e2e on every push and PR. Both jobs run on macos-latest — the PTY / ps / lsof integration tests rely on macOS behavior, and the e2e boot spawns a real WebServer driven by a real SessionManager.
When to run what
Section titled “When to run what”| Change | Suite |
|---|---|
| Pure function / parser change | bun test (the relevant file). |
| RPC handler / new method | bun test + bun run typecheck. |
| Web mirror server change | bun test + bun run test:e2e. |
| Webview UI / xterm interaction | bun run test:native. |
| Visual change | bun run report:design:web, then promote baseline once happy. |
| Before opening a PR | bun run test:full-suite. |