Skip to content

Fixes Convert-FailureLines for Core vs. Desktop PS#1475

Merged
nohwnd merged 3 commits into
pester:masterfrom
fourpastmidnight:fix-convert-failure-lines-for-pscore
Apr 4, 2020
Merged

Fixes Convert-FailureLines for Core vs. Desktop PS#1475
nohwnd merged 3 commits into
pester:masterfrom
fourpastmidnight:fix-convert-failure-lines-for-pscore

Conversation

@fourpastmidnight
Copy link
Copy Markdown
Contributor

For the desktop version of Powershell, when getting the exception
message, there would be 3 lines: the exeception name and message, any
parameter name, and then the inner exception type (and first line
message):

<Exception Name>: <first message line>
Parameter: <param name>
<Inner Exception Name>: <first inner exn line>

But, in PowerShell Core (7.0?), the output looked like this:

<Exception name>: <first message line> (Parameter '<param name>')
<Inner Exception name>: <first inner exn line>

This commit detects whether the first message line matches a regex that
matches the parenthesized parameter name in the first message line, and
if so, splits the line into two. This "normalizes" the message lines
between PowerShell Desktop and PowerShell Core.

For the desktop version of Powershell, when getting the exception
message, there would be 3 lines: the exeception name and message, any
parameter name, and then the inner exception type (and first line
message):

<Exception Name>: <first message line>
Parameter: <param name>
<Inner Exception Name>: <first inner exn line>

But, in PowerShell Core (7.0?), the output looked like this:

<Exception name>: <first message line> (Parameter '<param name>')
<Inner Exception name>: <first inner exn line>

This commit detects whether the first message line matches a regex that
matches the parenthesized parameter name in the first message line, and
if so, splits the line into two. This "normalizes" the message lines
between PowerShell Desktop and PowerShell Core.
@fourpastmidnight
Copy link
Copy Markdown
Contributor Author

@nohwnd Is it possible to get this merged? It's blocking successful test passes for PR #1276, which I would love to finally get merged! 😄

nohwnd added 2 commits April 4, 2020 07:19
The text changed in powershell 7
@nohwnd nohwnd merged commit 9c84249 into pester:master Apr 4, 2020
@nohwnd
Copy link
Copy Markdown
Member

nohwnd commented Apr 4, 2020

Done, sorry for the holdup, I mostly ignore Pester notifications during week, because I work on github and they would distract me :)

@fourpastmidnight
Copy link
Copy Markdown
Contributor Author

fourpastmidnight commented Apr 4, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants