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
Sign in to join this conversation.
new above
offline
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.tsopens the database, sets raw mode, writes ANSI and exits, all at import.screen.tsandkeys.tsunder 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, whetherxon 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.tsonly if the escaping test finds something.Risks
This is a seam and a test, not a rewrite of the terminal:
screen.tsandkeys.tskeep their signatures and their tests. Raw mode andprocess.exitinside 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.