pester / Pester

Pester is the ubiquitous test and mock framework for PowerShell.
https://pester.dev/
Other
3.05k stars 469 forks source link

Fix console warnings in Should-BeEquivalent.Tests.ps1 #2488

Closed fflaten closed 1 month ago

fflaten commented 1 month ago

PR Summary

Removes "Getting default equivalency options" warning spam in tests.ps1 ouptut. Fixed by providing default options by... well, default in Should-BeEquivalent.Tests.ps1.

Also replaces some calls to New-Object

PR Checklist

nohwnd commented 1 month ago

Clever. I would not think about doing it this way. Can the warning now be removed from the assertion and throw when the options are not provided?

fflaten commented 1 month ago

Yes, I can update the PR tomorrow unless you've already fixed it by then.

nohwnd commented 1 month ago

I won't, too many other things to fix before psconf :D

fflaten commented 1 month ago

Changed to only check if parameter was not provided (allows null). PSDefaultParameters-trick didn't work for nested Compare-Equivalent calls even if I set the default option for the caller, e.g.Compare-DictionaryEquivalent.

Didn't bother to troubleshoot further after I noticed title change on issue #2477 planning to remove this code 🙂