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

Fix formatting for Set-ItResult with because, removing trailing comma and redundant "because" #2589

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

wethreetrees
Copy link
Contributor

PR Summary

Fix #2588

Fixes the formatting of the Set-ItResult exception message when a -Because is provided.

This change removes the "because" being added to the message before including the content of Format-Because (which includes the "because"). It also strips out the trailing comma, as it's not needed or expected here.

The current message is formatted with a redundant "because" and a trailing comma.

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,

PR Checklist

  • PR has meaningful title
  • Summary describes changes
  • PR is ready to be merged
    • If not, use the arrow next to Create Pull Request to mark it as a draft. PR can be marked Ready for review when it's ready.
  • Tests are added/update (if required)
  • Documentation is updated/added (if required)

@nohwnd nohwnd merged commit 62823f5 into pester:main Dec 16, 2024
11 checks passed
@nohwnd
Copy link
Member

nohwnd commented Dec 16, 2024

/backport to 5.x.x

Copy link

Started backporting to 5.x.x: https://github.com/pester/Pester/actions/runs/12349993536

Copy link

@nohwnd an error occurred while backporting to 5.x.x, please check the run log for details!

The process '/usr/bin/git' failed with exit code 1

@nohwnd
Copy link
Member

nohwnd commented Dec 18, 2024

/backport to rel/5.x.x

Copy link

Started backporting to rel/5.x.x: https://github.com/pester/Pester/actions/runs/12389574371

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.

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