Skip to content

toHaveCursorStyle

Deprecated

Prefer toHaveCursor which checks multiple cursor properties at once:

typescript
expect(term).toHaveCursor({ style: "block" })

Assert that the terminal cursor has a specific style (shape).

Signature

typescript
expect(term).toHaveCursorStyle(style: CursorStyle, options?: { timeout?: number })

Parameters

ParameterTypeDescription
styleCursorStyleExpected cursor style
options.timeoutnumberAuto-retry timeout in ms (Playwright-style)

CursorStyle: "block" | "underline" | "beam"

Usage

typescript
// Block cursor (default for most terminals)
expect(term).toHaveCursorStyle("block")

// Beam cursor (common in insert mode)
expect(term).toHaveCursorStyle("beam")

// Underline cursor
expect(term).toHaveCursorStyle("underline")

// With auto-retry
await expect(term).toHaveCursorStyle("beam", { timeout: 5000 })

Accepts

TargetSupported
term (TerminalReadable)Yes
term.screenNo
term.cell(r, c)No

See Also