You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It "should not fail" {
{ throw 'helpful error message' } | Should Not Throw
}
I get the following output.
[-] should fail 2ms
Expected: the expression to not throw an exception
at line: 9 in C:\Code\sample\powershellTests\src\run-sample.Tests.ps1
When an exception happens in a test, I would be helpful if we could see the actual exception. Currently the exception information appears to be swallowed and is hiding crucial details that would help us diagnose a failing test.
Similarly if we say "{ something } | Should Throw" I would be great if you could consider a syntax that would allow us to assert more specific information about the error.
Possibly something like
{ throw "hi"; } | Should Throw "hi"
Keeping in mind wild card or regex searches
{ [string]::Format("{0} {1}", "hello") } | Should Throw "*Index (zero based) must be greater than or equal to zero and less than the size of the argument list.*"
Or be able to determine the type of the exception object.
The text was updated successfully, but these errors were encountered:
Given the following test
I get the following output.
When an exception happens in a test, I would be helpful if we could see the actual exception. Currently the exception information appears to be swallowed and is hiding crucial details that would help us diagnose a failing test.
Similarly if we say "{ something } | Should Throw" I would be great if you could consider a syntax that would allow us to assert more specific information about the error.
Possibly something like
Keeping in mind wild card or regex searches
Or be able to determine the type of the exception object.
The text was updated successfully, but these errors were encountered: