tuil
ReferencePackages

@mwillbanks/tuil-testing-ink

Ink-backed renderer and interaction harness for testing tuil applications.

View rawEdit

Overview

Ink-backed renderer and interaction harness for testing tuil applications.

@mwillbanks/tuil-testing-ink is independently installable and also participates in the umbrella @mwillbanks/tuil runtime where applicable.

Installation

npm install @mwillbanks/tuil-testing-ink

How it operates

The Ink test renderer creates a real tuil runtime and semantic registry around ink-testing-library, then coordinates input, resize, frame, event, focus, and cleanup helpers.

Documentation flow diagram. render runtime; interact; flush; inspect; unmount; S0 leads to S1; S1 leads to S2; S2 leads to S3
Documentation flow diagram. render runtime; interact; flush; inspect; unmount; S0 leads to S1; S1 leads to S2; S2 leads to S3

API

APISignatureDescription
cleanupfunction cleanupPublic function cleanup.
clickPointerTargetfunction clickPointerTargetPublic function clickPointerTarget.
dragPointerTargetfunction dragPointerTargetPublic function dragPointerTarget.
normalizeTerminalFrameexport normalizeTerminalFramePublic export normalizeTerminalFrame.
renderTuilfunction renderTuilPublic function renderTuil.
screenconstant screenPublic constant screen.
SemanticScreenexport SemanticScreenPublic export SemanticScreen.
TuilTestInstanceinterface TuilTestInstancePublic interface TuilTestInstance.
TuilUserclass TuilUserPublic class TuilUser.
userconstant userPublic constant user.

Events and lifecycle

Tests can inspect event history and wait on rendered state after input settles.

All subscriptions and registrations return a disposer or belong to an owning runtime that disposes them in reverse order.

Example

import { renderTuil } from "@mwillbanks/tuil-testing-ink";

const view = renderTuil(<Button id="run">Run</Button>);
await view.press("enter");

On this page