LibTmux.Testing
0.0.0-alpha.22
Prefix Reserved
dotnet add package LibTmux.Testing --version 0.0.0-alpha.22
NuGet\Install-Package LibTmux.Testing -Version 0.0.0-alpha.22
<PackageReference Include="LibTmux.Testing" Version="0.0.0-alpha.22" />
<PackageVersion Include="LibTmux.Testing" Version="0.0.0-alpha.22" />
<PackageReference Include="LibTmux.Testing" />
paket add LibTmux.Testing --version 0.0.0-alpha.22
#r "nuget: LibTmux.Testing, 0.0.0-alpha.22"
#:package LibTmux.Testing@0.0.0-alpha.22
#addin nuget:?package=LibTmux.Testing&version=0.0.0-alpha.22&prerelease
#tool nuget:?package=LibTmux.Testing&version=0.0.0-alpha.22&prerelease
LibTmux.Testing
Scoped tmux servers, sessions and windows for testing code that drives tmux, on top of LibTmux.
Each scope owns what it created and tears it down on dispose, including after a failure, so a test that throws does not leave a server behind.
Add it to your test project:
$ dotnet package add LibTmux.Testing --prerelease
Alpha. The public API will change between prereleases without notice, so pin an exact version.
Quick start
Give a test a tmux server of its own, type into its pane, and wait for the
result. The block uses ct from your test:
TmuxTestFactory factory = new();
await using TemporaryHierarchyScope scope = await factory.CreateHierarchyAsync(cancellationToken: ct);
await scope.Pane.SendTextAsync("echo $((6 * 7))", cancellationToken: ct);
await scope.Pane.EnterAsync(ct);
// The product is printed only once the shell has run the line.
string screen = await TmuxWait.UntilAsync(
async token => string.Join('\n', await scope.Pane.CaptureAsync(cancellationToken: token)),
text => text.Contains("42", StringComparison.Ordinal),
TimeSpan.FromSeconds(10),
TimeSpan.FromMilliseconds(20));
It prints nothing and returns once the pane shows 42. Disposing the scope
kills the server, even when an assertion above it throws.
Create the scopes a test needs
TmuxTestFactory: a server, session, window, or whole hierarchy
CreateHierarchyAsync
starts a server on a socket of its own, with one session, window, and pane.
The TemporaryServerScope,
TemporarySessionScope, and
TemporaryWindowScope types stop at the
level their name gives. TmuxNameGenerator
hands out names no live session is using.
TmuxWait.UntilAsync: wait for a state
It polls a state until a condition holds or a timeout passes, and it replaces a
sleep. It ships in LibTmux, because reading back what a command produced is
ordinary client work.
What it leaves out
- Test scaffolding in your application. This ships apart from
LibTmux, so an application that references the client carries no test scaffolding in its output or its trim closure. - Your own tmux. Left alone, a test gets a socket nothing else can use, so a throwaway server never points at your tmux or kills it on the way out.
Support and status
- Alpha. Any release may change or remove exported identifiers. Pin an exact version.
- Dependencies. LibTmux.
- tmux and .NET. The tmux versions LibTmux supports, on net8.0 and net10.0.
- Systems. Linux, including WSL. CI also runs macOS arm64 and builds on Windows x64.
Documentation
- Testing with libtmux on libtmux.org: an isolated server and cleanup failures
TmuxTestFactoryandTemporaryHierarchyScope- Source:
src/LibTmux.Testing; issues and history on GitHub
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.0-alpha.22 | 44 | 10/19/2026 |
| 0.0.0-alpha.21 | 51 | 10/11/2026 |
| 0.0.0-alpha.20 | 57 | 10/5/2026 |
| 0.0.0-alpha.19 | 65 | 10/4/2026 |
| 0.0.0-alpha.18 | 58 | 10/3/2026 |
| 0.0.0-alpha.17 | 69 | 9/27/2026 |
| 0.0.0-alpha.16 | 66 | 9/26/2026 |
| 0.0.0-alpha.15 | 75 | 9/20/2026 |
| 0.0.0-alpha.14 | 70 | 9/20/2026 |
Alpha. LibTmux, LibTmux.FSharp, LibTmux.Testing, LibTmux.Query.Json, LibTmux.Extensions.DependencyInjection, LibTmux.Workspace, LibTmux.Workspace.Cli and LibTmux.Mcp share one version, so this release covers them together. What changed, per package and per release: https://github.com/libtmux/libtmux-dotnet/blob/master/CHANGELOG.md The public API is not settled and may change without notice between prereleases; pin an exact version.