We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Sometimes you need to test a case where you expect the action to throw an exception. To do that, pass a script block to Should Throw:
{ Call-ScaryFunction } | Should Throw
Should Throw will eat the pipeline output and the exception and assert that an exception was thrown.
You can also test that the exception matches a particular pattern by adding a pattern after Throw:
{ Call-ScaryFunction } | Should Throw "egad"
There was an error while loading. Please reload this page.