# tmuxtest.NewWindow

- **Module:** tmuxtest
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-go/blob/5f808882015a975a65acc7f9da5b3ff0d5cbdc91/tmux/tmuxtest/resources.go#L69
- **Page:** https://libtmux.org/reference/go/tmuxtest-newwindow/

```
tmuxtest.NewWindow(ctx: context.Context, t: testing.TB, session: tmux.Session, request: tmux.NewWindowRequest) -> tmux.Window
```

NewWindow creates a test-owned [tmux.Window] and registers cleanup against its stable ID. A nil [tmux.NewWindowRequest.Name] receives a collision-checked temporary name; an empty non-nil name remains explicit. The request and referenced values are copied before tmux is called, and setup failures call [testing.TB.Fatal]. Cleanup belongs to t rather than ctx and follows the window if it is moved.
