Asserts that the last process failed by checking PowerShell's $LastExitCode
automatic variable.
Assert-LastProcessFailed [[-Message] <String>] [<CommonParameters>]
A process fails if $LastExitCode
is non-zero.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Message | String | The message to show if the assertion fails. |
false | false |
Assert-LastProcessFailed
Demonstrates how to assert that the last process failed.
Assert-LastProcessFailed 'cmd.exe'
Demonstrates how to show a custom message when the assertion fails.