tcmts.cli.test.e2e.traces

Shared

BOARD "// tcm: namespace board\nimport { enqueue, table } from \"#codebase/lib/server\";\n\nexport const …
BROWSER_BOARD "// tcm: namespace board\nimport { table } from \"#codebase/lib/server\";\n\nexport const posts = t…
FAILING_BOARD "// tcm: namespace board\nimport { request } from \"#codebase/lib/server\";\n\nexport function pars…
ORDER (ms: number) => string
The shop's `order`: as it is, or slowed by `ms` of work.
SHOP_CALLS "// tcm: namespace shop\nimport { table } from \"#codebase/lib/server\";\n\nexport const items = ta…

Tests

testDevTracesEveryCall () => Promise<void>
`tcm dev --trace-calls`: each call to one of the codebase's functions on the server is a span inside the call it was made in, so a server function's trace is the whole tree of what it ran, async calls included, its statements where they ran; and what it calls behaves as it did (its result, and its source written out).
testErrorsGroupByWhatThrewThem () => Promise<void>
Errors grouped by the definition that threw them (found from their stacks), what they said alike (`no post 1`, `no post 2`), once a trace however many spans they went up through, each with the version it began with and the history entry that made it; a page's uncaught errors too, where `tcm dev` serves the module that threw.
testProductionPageErrorsNameTheirDefinition () => Promise<void>
A production page's uncaught error is traced to the definition that threw it, through its chunk's source map, which the build keeps apart: the chunk doesn't name it, and it isn't served.
testSlowerVersionsNameTheirChange () => Promise<void>
A version that runs worse than the one before says the change that did it: a server function re-hashed because something it uses changed is found slower than its last version, with the definition whose own code changed and the history entry (its message) that made it so.
testTracesAcrossTheBrowser () => Promise<void>
Traces across the browser: a page goes on in the trace the server began as it sent the page; its view, its navigations and each call it makes are spans, a call saying which definition made it, with the server's spans for it inside it; and `tcm traces` says where a definition's calls came from.
testTracesWithoutSetup () => Promise<void>
Traces with nothing set up: `tcm start` records a span for each server function call, with its table statements inside and the job it enqueued linked; `tcm traces` shows them by definition as named now (a rename since included), a definition's versions side by side, and a trace as a tree; and OTLP gets them where OpenTelemetry's variables say, the caller's trace kept.