Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set-ItResult adds an extra because and a trailing comma to the thrown exception message #2588

Closed
3 tasks done
wethreetrees opened this issue Dec 16, 2024 · 0 comments · Fixed by #2589
Closed
3 tasks done

Comments

@wethreetrees
Copy link
Contributor

Checklist

What is the issue?

Set-ItResult prepends a redundant "because" and appends a comma to the end of the -Because in the exception message.

Expected Behavior

Set-ItResult, when given a -Because message, should append that to the result type message

ex:

try {
    Set-ItResult -Skipped -Because "we are forcing it to skip"
} catch {
    $_.Exception.Message
}

Expected:

is skipped, because we are forcing it to skip

Actual:

is skipped, because  because we are forcing it to skip,

Steps To Reproduce

try {
    Set-ItResult -Skipped -Because "we are forcing it to skip"
} catch {
    $_.Exception.Message
}

Describe your environment

Pester version : 5.6.1 C:\Users\Tyler\Documents\PowerShell\Modules\Pester\5.6.1\Pester.psm1
PowerShell version : 7.4.6
OS version : Microsoft Windows NT 10.0.19045.0

Possible Solution?

This should be a simple change to the formatting for the Because message in the Set-ItResult function to remove the redundant "because" and strip the trailing comma.

I have the changes up in a fork now and will be submitting a PR shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant