Skip to content

Improve error message for array comparison in Should -Be#2699

Open
yezhi0 wants to merge 2 commits intopester:mainfrom
yezhi0:main
Open

Improve error message for array comparison in Should -Be#2699
yezhi0 wants to merge 2 commits intopester:mainfrom
yezhi0:main

Conversation

@yezhi0
Copy link
Copy Markdown

@yezhi0 yezhi0 commented Apr 21, 2026

This PR improves the error message when Should -Be compares two arrays that differ in length or type, but appear identical due to unrolling.

Changes:

  • Add detection for collection length and type differences.
  • Show a clear message with expected and actual lengths and types.
  • Preserve existing behavior for string comparisons.

Fixes #1154

yezhi0 added 2 commits April 21, 2026 23:21
Show collection length and type when array comparison fails due to
different lengths or types, addressing confusing error messages
where both sides appeared identical.

Related: pester#1154
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.

Should -Be gives confusing error message comparing arrays that are not enumerated.

1 participant