Function: mountInk()
@termwright/ink / mountInk
Function: mountInk()
Section titled “Function: mountInk()”mountInk(
element,options?):Promise<InkHarness>
Defined in: ink/src/mount.tsx:148
Mounts an Ink element in this process and returns a harness over it.
The component runs against a headless VT emulator fed by Ink’s own output, so
everything the driver offers a real terminal applies here: getByRole,
viewport cells and press() as key bytes. No callback is ever invoked
directly on the component — asserting a prop spy after physical input is
the point. Ink currently leaves occlusion unknown, so semantic click is
deliberately refused; drive activation with the keyboard.
The mount resolves once the first frame has been published, so locators work immediately.
Parameters
Section titled “Parameters”element
Section titled “element”ReactNode
options?
Section titled “options?”MountInkOptions = {}
Returns
Section titled “Returns”Promise<InkHarness>
Example
Section titled “Example”const onPress = vi.fn();const harness = await mountInk(<Approve onPress={onPress} />, { columns: 40, rows: 10 });await harness.press('Tab');await harness.waitForQuiet();await harness.press('Enter');await harness.waitForText('approved');await vi.waitFor(() => expect(onPress).toHaveBeenCalledOnce());await harness.close();