Skip to content

toBeInMode

Assert that a specific terminal mode is enabled.

Signature

typescript
expect(term).toBeInMode(mode: TerminalMode, options?: { timeout?: number })

Parameters

ParameterTypeDescription
modeTerminalModeThe mode to check
options.timeoutnumberAuto-retry timeout in ms (Playwright-style)

Available modes:

ModeDescription
"altScreen"Alternate screen buffer (DECSET 1049)
"cursorVisible"Cursor visibility (DECTCEM)
"bracketedPaste"Bracketed paste mode
"applicationCursor"Application cursor keys (DECCKM)
"applicationKeypad"Application keypad mode
"autoWrap"Auto-wrap at line end (DECAWM)
"mouseTracking"Mouse tracking enabled
"focusTracking"Focus in/out events
"originMode"Origin mode (DECOM)
"insertMode"Insert mode (IRM)
"reverseVideo"Reverse video (DECSCNM)

Usage

typescript
// Check alternate screen
expect(term).toBeInMode("altScreen")

// Check bracketed paste
expect(term).toBeInMode("bracketedPaste")

// Check mouse tracking
expect(term).toBeInMode("mouseTracking")

// Negation
expect(term).not.toBeInMode("insertMode")

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

Accepts

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

See Also