# LibTmux.Workspace\Test-TmuxWorkspace

- **Package:** LibTmux.Workspace
- **Language:** PowerShell
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/src/LibTmux.Workspace.PowerShell/TestTmuxWorkspaceCommand.cs#L7
- **Page:** https://libtmux.org/en/powershell/latest/workspace/reference/libtmux-workspace-test-tmuxworkspace/

```
Test-TmuxWorkspace
    [-Workspace] <LibTmux.Workspace.WorkspaceFile>
    [-ExistingSession <LibTmux.Workspace.WorkspaceExistingSession>]
    [-ServerStartup <LibTmux.Workspace.WorkspaceServerStartup>]
    [-Readiness <LibTmux.Workspace.WorkspaceReadiness>]
    [-ReadinessTimeout <System.Double>]
    [-CompensateOnFailure]
    [-AllowHostScripts]
    [-HostScriptTimeout <System.Double>]
    [-MaxHostOutputBytes <System.Int32>]
    [-CleanupTimeout <System.Double>]
    [<CommonParameters>]
```

Validate a workspace declaration and its intended policies locally.

Apply the shared .NET declaration and policy checks to a native WorkspaceFile.
Validation reads no tmux state and executes no commands or scripts. Importing a
workspace checks syntax; this command additionally rejects incomplete or invalid
declarations under the supplied policy.

Validation returns True on success. An invalid declaration writes its native
error and returns False; [`ErrorAction`](/en/powershell/latest/workspace/reference/libtmux-workspace-test-tmuxworkspace/#LibTmux.Workspace%5CTest-TmuxWorkspace.parameter.ErrorAction) Stop terminates instead. Invalid policy
parameters terminate before processing input.

Local validation does not check endpoint conflicts, paths on disk, shell syntax
or tmux option support. Reuse defers host-script admission until planning knows
whether creation is needed. Use [`Get-TmuxWorkspacePlan`](/en/powershell/latest/workspace/reference/libtmux-workspace-get-tmuxworkspaceplan/) for endpoint observation
and a reviewable plan; the validation result is not permission to apply it.

### Notes

[`Tmux.WorkspaceValidationFailed`](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux.Workspace/Test-TmuxWorkspace.md#notes) retains the native exception and declaration. [`Tmux.InvalidWorkspacePolicy`](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux.Workspace/Test-TmuxWorkspace.md#notes) identifies invalid policy parameters.

## Command details

- **Command type:** [`cmdlet`](/en/powershell/latest/workspace/reference/glossary/#cmdlet)
- **Positional binding:** Enabled.
- **Pipeline inputs:** `LibTmux.Workspace.WorkspaceFile`: A parsed or programmatically constructed declaration.
- **Outputs:** `System.Boolean`

Related APIs:

- [`Import-TmuxWorkspace`](/en/powershell/latest/workspace/reference/libtmux-workspace-import-tmuxworkspace/)
- [`Get-TmuxWorkspacePlan`](/en/powershell/latest/workspace/reference/libtmux-workspace-get-tmuxworkspaceplan/)

## Examples

Example 1

Check a one-window declaration without opening a tmux connection.

[Source example](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux.Workspace/Test-TmuxWorkspace.md).

```powershell
LibTmux.Workspace\Import-TmuxWorkspace -Yaml @'
session_name: development
windows:
  - panes: [null]
'@ | LibTmux.Workspace\Test-TmuxWorkspace
```

## Parameters

- `Workspace` (`LibTmux.Workspace.WorkspaceFile`): The immutable declaration to check.
  Required. Position 0. Accepts pipeline input by value. [`ValidateNotNull()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnullattribute?view=powershellsdk-7.4.0).
- `ExistingSession` (`LibTmux.Workspace.WorkspaceExistingSession`): Reuse defers host-script admission until planning determines whether creation is necessary.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `Error`. [`ValidateSet(["Error","Reuse","Append","Replace"])`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatesetattribute?view=powershellsdk-7.4.0).
- `ServerStartup` (`LibTmux.Workspace.WorkspaceServerStartup`): The startup policy intended for planning; validation does not inspect the endpoint.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `CreateOrJoin`. [`ValidateSet(["CreateOrJoin","RequireExisting"])`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatesetattribute?view=powershellsdk-7.4.0).
- `Readiness` (`LibTmux.Workspace.WorkspaceReadiness`): The declared startup contract; validation does not wait for or prove shell readiness.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `Immediate`. [`ValidateSet(["Immediate","Cooperative"])`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatesetattribute?view=powershellsdk-7.4.0).
- `ReadinessTimeout` (`System.Double`): A finite positive readiness budget in seconds, at most 86400.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `10`.
- `CompensateOnFailure` (`System.Management.Automation.SwitchParameter`): Validate the policy that permits compensation of journal-owned creations after application failure.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Documented default: `False`.
- `AllowHostScripts` (`System.Management.Automation.SwitchParameter`): Admit declared host scripts for planning. Validation never executes them.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Documented default: `False`.
- `HostScriptTimeout` (`System.Double`): A finite positive host-script budget in seconds, at most 86400.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `30`.
- `MaxHostOutputBytes` (`System.Int32`): A positive combined stdout and stderr capture limit in UTF-8 bytes.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `1048576`.
- `CleanupTimeout` (`System.Double`): A finite positive application cleanup budget in seconds, at most 86400.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `1`.
- `Verbose` (`System.Management.Automation.SwitchParameter`): Display verbose messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `vb`.
- `Debug` (`System.Management.Automation.SwitchParameter`): Display debug messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `db`.
- `ErrorAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to non-terminating errors.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ea`.
- `WarningAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to warning messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wa`.
- `InformationAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles information messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `infa`.
- `ProgressAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles progress updates.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `proga`.
- `ErrorVariable` (`System.String`): Store the command's error records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ev`.
- `WarningVariable` (`System.String`): Store the command's warning records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wv`.
- `InformationVariable` (`System.String`): Store the command's information records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `iv`.
- `OutVariable` (`System.String`): Save output in the named variable while passing it down the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ov`.
- `OutBuffer` (`System.Int32`): Buffer output before passing it to the next pipeline command.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ob`.
- `PipelineVariable` (`System.String`): Make the most recent output object available through a named variable within the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `pv`.

## Returns

`System.Boolean`: True for a valid declaration; False after a nonterminating validation error.
