Core LibraryalphaGuides

Choose documentation 3

latest

Current version

latest
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

Edit this page on GitHub

Testing with libtmux

The repository’s internal test harness is not a published API. For an external test, create a Server with a private socket and register cleanup in your test framework. The complete capture program demonstrates startup checks, a bounded output wait and visible cleanup failures.

Run a complete example

Capture pane output includes a complete TypeScript executable, imports, dependency setup and cleanup. Its output check fails when the expected line does not arrive before the deadline. Start with that program when adapting the pattern to your own test runner.

Keep server ownership explicit

Give each test a private socket and a known tmux configuration. Stop the server the test creates, including when startup or an assertion fails. Preserve the original failure and report cleanup errors so a leaked server remains visible.

A connection to an existing server has a different lifetime. The attach program leaves that server running and lets its launcher own cleanup.

Wait for the state you assert

Wait for the actual output or completion condition with a deadline. Sending keys returning successfully does not establish that the application finished. Capturing output explains the difference between a screen snapshot and a stream of output.

Esc

Type to search.

Reference preview Open reference