Skip to content

Matcher Reference ​

Termless provides 25 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 Region (screen, scrollback, row, range).

Raw Output Matchers ​

Work on RawOutput via term.output for protocol bytes before terminal parsing.

Style Matchers prefer toHaveAttrs ​

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

Cursor Matchers prefer toHaveCursor ​

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

Terminal State Matchers ​

Work on Terminal (the terminal itself).

Snapshot Matchers ​

Work on Terminal (the terminal itself).