Fix #2555 and #2561: Should-BeNull pipeline and escape chars in error messages#2685
Closed
nohwnd wants to merge 1 commit intopester:mainfrom
Closed
Fix #2555 and #2561: Should-BeNull pipeline and escape chars in error messages#2685nohwnd wants to merge 1 commit intopester:mainfrom
nohwnd wants to merge 1 commit intopester:mainfrom
Conversation
…ars in error messages pester#2555: Should-BeNull now treats empty pipeline input as $null. When a function returns no output, PowerShell sends @() through the pipeline. Should-BeNull recognizes this as "no output" and treats it as null, matching user expectations. Explicit @() via parameter still fails. pester#2561: Format-String2 now escapes control characters (NUL, BEL, BS, TAB, FF, CR, LF, ESC) as Unicode control pictures (␀␇␈␉␌␍␊␛) so they are visible in assertion error messages instead of being invisible or corrupting terminal output. This is especially important for ANSI escape sequences.
Member
Author
|
split into multiple prs... one fix per pr. |
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pester 6 Fixes (Copilot-driven)
Fixes two issues from the 6.0.0 milestone.
Fix #2555: Should-BeNull treats empty pipeline input as null
When a function returns no output and the result is piped to Should-BeNull, PowerShell sends an empty array through the pipeline. Should-BeNull now recognizes this as "no output" and treats it as null, matching user expectations.
Should-BeNull -Actual @())Fix #2561: Escape characters visible in assertion error messages
Format-String2 now escapes control characters as Unicode control pictures so they are visible in error messages instead of being invisible or corrupting terminal output.
Before:
Expected [string] '', but got [string] '31;3;5m'.After:
Expected [string] 'hello', but got [string] 'U+241B[31m'.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com