# Testing Ink

> Use when writing or modifying tests for Ink (terminal UI) components.

- Skill: `landonschropp/testing-ink` (Agent Skill)
- Install (CLI): `npx skillmds@latest add landonschropp/testing-ink`
- Raw SKILL.md: https://api.skillmd.com/api/skills/landonschropp/testing-ink/raw
- Safety review: PASS (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: LandonSchropp (https://skillmd.com/u/landonschropp)
- Updated: 2026-08-19
- Page: https://skillmd.com/skills/landonschropp/testing-ink

---


# Testing Ink Components

Use `render` from `ink-testing-library`, not `@testing-library/react`. Ink has its own renderer, so the DOM library can't reach it.

```tsx
import { render } from "ink-testing-library";

const { lastFrame, frames, rerender } = render(<MyComponent />);
expect(lastFrame()).toContain("expected text");
```

- `lastFrame()`: the most recent rendered terminal frame as a string.
- `frames`: the full array of frames in render order.
- `rerender(<MyComponent prop={next} />)`: re-render with new props.

## Testing hooks in a Bun project

Bun has no DOM, so testing a hook (via `ls-typescript:testing-react`) needs DOM globals registered. Call `@happy-dom/global-registrator` before any `@testing-library/react` import, so the DOM is present when React DOM loads.

```tsx
import { GlobalRegistrator } from "@happy-dom/global-registrator";

GlobalRegistrator.register();

import { renderHook } from "@testing-library/react";
```

