tcmts.cli.test.e2e.contributions

Types

Keep type
What withChildren hands a test: keeps a process, to kill when the test ends.

Server

codebase (root: string, name: string) => { dir: string; run: (...args: string[]) => { status: number | null;…
env () => ProcessEnv
startServer (keep: Keep, dir: string, token: string, args?: string[]) => Promise<string>
Start `tcm serve` on a free port (with `args` besides); resolves to its base URL.

Shared

LIB "// tcm: namespace lib\nexport const square = (x: number): number => x * x;\nexport const sumSquare…
uiPage (url: string, timeoutMs?: number) => Promise<{ status: number; html: string; }>
A page of a server, as a browser asks for it (server-rendered HTML), once it answers: the web UI starts when it's first asked for.

Tests

testContributeReviewMerge () => void
contribute, review, comment and merge; conflicts are refused until the branch takes the target in
testContributionMergesAsText () => void
A contribution editing a definition its target changed too, apart, is previewed as the merge settles it: merged as text, not a conflict, and merged so. One whose edits are apart but don't typecheck merged is refused, and the target is left as it was (no conflict on it).
testContributorsAndPublicRead () => Promise<void>
a public server: anyone pulls and reads; a contributor's token pushes and proposes only branches under their handle, signed as them; only the maintainer's merges, and removing a contributor stops their token
testIllTypedContributionIsRefusedAtMerge () => Promise<void>
A server takes code that doesn't typecheck on a contributor's branch, as a client can post it by hand (here: code saved where an implicit any is fine, sent saying it was checked strictly), and refuses to merge it, saying why.
testPublicServerStartsTheWebUiAhead () => Promise<void>
a public tcm serve starts its web UI as it starts listening, before anyone asks for it, so its first reader doesn't wait for its build
testWebUi () => Promise<void>
the web UI on tcm serve: the codebase's pages and a contribution's review, rendered on the server in any order, a contributor signed in by the link `tcm contribute` prints, commenting as their handle, and the maintainer merging; a site served beside it keeps its own pages
testWebUiStopsWithTheServer () => Promise<void>
the web UI stops with the tcm serve that started it, however that ended: killed, its exit handlers never run