Skip to content

Matcher Reference

Termless provides 24 custom Vitest matchers for terminal assertions. All matchers support .not negation.

typescript
import "@termless/test/matchers" // Auto-registers all matchers

Composable Matchers

Assert multiple properties at once with partial matching. These are the recommended API.

  • toHaveAttrs - Assert cell attributes (bold, italic, fg, bg, etc.)
  • toHaveCursor - Assert cursor properties (position, visibility, style)

Text Matchers

Work on RegionView (screen, scrollback, row, range).

Style Matchers prefer toHaveAttrs

Work on CellView via term.cell(row, col). Prefer toHaveAttrs for new code.

Cursor Matchers prefer toHaveCursor

Work on TerminalReadable (the terminal itself). Prefer toHaveCursor for new code.

Terminal State Matchers

Work on TerminalReadable (the terminal itself).

Snapshot Matchers

Work on TerminalReadable (the terminal itself).