Guides
Testing
Test terminal behavior through semantics, frames, events, focus, and portable stories.
const view = renderTuil(
<Button id="run" label="Run build" onPress={() => calls.push("run")}>
Run
</Button>,
);
expect(view.screen.getByRole("button", { name: "Run build" })).toBeEnabled();
await view.press("enter");
expect(calls).toEqual(["run"]);
await view.unmount();Test layers
- Pure unit tests for resolvers, reducers, virtual ranges, and formatters.
- Semantic component tests for role, label, state, focus, and callbacks.
- Frame assertions for output where visual layout is the contract.
- Runtime tests for lifecycle, events, plugins, routing, and teardown.
- Portable stories for cross-surface component states.
Capability matrix
Test interactive and static modes, narrow and wide viewports, Unicode and ASCII, reduced motion, color depths, and non-TTY redirected output when the component branches on those capabilities.
Portable story frames published in the Playground and Showcase use the same renderer and semantic capture as tests.