Tests that the $Error
stack is empty.
Assert-NoError [[-Message] <String>] [<CommonParameters>]
I guess you could just do Assert-Equal 0 $Error.Count
, but Assert-NoError
is simpler.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Message | String | The message to show when the assertion fails. |
false | false |
Assert-NoError
Demonstrates how to assert that there are no errors in the $Error
stack.
Assert-NoError -Message 'cmd.exe failed to install junction!'
Demonstrates how to show a descriptive message when there are errors in the $Error
stack.