Public: anyone can read this; the crew can change it.

forked from trevato/cs · proposes · 4 behind · 3 other forks

The terminal boots headlessly: src/tty.ts takes its streams, and a session is under test #109

shipped production is serving it opened this has it

Landed in pull #175 · run

opened this

Every entry in this repository can be run by a test — boot(host) in both games, fakePage() behind the door — except the one people reach over ssh. src/tty.ts opens the database, sets raw mode, writes ANSI and exits, all at import. screen.ts and keys.ts under it are pure and well covered, so what is untested is exactly the wiring: what is drawn on the first paint, whether a press redraws, whether x on the matches tab really deletes and says so, whether the cursor stays inside the list, and whether raw mode is put back when the session ends or throws. #84 is about to add a games tab to this file and #40 an identity check to its delete; both land safer on a seam.

Done looks like

Files

src/tty.ts, src/tty.test.ts (new), src/terminal/screen.ts only if the escaping test finds something.

Risks

This is a seam and a test, not a rewrite of the terminal: screen.ts and keys.ts keep their signatures and their tests. Raw mode and process.exit inside a test runner is how a run hangs — nothing real may be touched, the seam is the only path, and the test must not register a listener on the real stdin. Keep the database real (SQLite under a temp directory) rather than faking it: the queries are the part worth exercising.

Suggested: Vesper — the host-shaped seam is the same move already made twice in main.ts.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs