cmdtest

package
v0.35.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package cmdtest runs tea commands in tests without waiting on timers.

A component's Update returns commands of two kinds: work that answers at once (a query, a focus request, a message) and timers that sleep first (a cursor blink, a spinner frame). Tests want the first and not the second. tuilib's own timers go through internal/tick, which tick.Instant makes return at once; timers from other libraries — bubbles' cursor blink — cannot be reached that way, so Run gives each command a moment and drops the ones still sleeping.

Index

Constants

View Source
const Grace = 20 * time.Millisecond

Grace is how long a command may take before Run treats it as a timer.

Variables

This section is empty.

Functions

func Run

func Run(cmd tea.Cmd) []tea.Msg

Run runs cmd, flattening batches, and returns the messages of the commands that answered within Grace. Each command runs at most once.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL