Pester icon indicating copy to clipboard operation
Pester copied to clipboard

Why does `@($null) | Should -BeNullOrEmpty` pass?

Open frerksaxen opened this issue 9 months ago • 0 comments

Checklist

What is the issue?

I do get that @() | Should -BeNullOrEmpty should pass especially, because @() is empty and @() | Should -HaveCount 0 passes. However, @($null) is not empty (it has one element) and @($null) does not equal $null So, why does @($null) | Should -BeNullOrEmpty pass?

Expected Behavior

@($null) | Should -BeNullOrEmpty should fail

Steps To Reproduce

@($null) | Should -BeNullOrEmpty

Describe your environment

Pester version : 5.7.1 PowerShell version : 7.4.7 OS version : Microsoft Windows NT 10.0.19045.0

Possible Solution?

No response

frerksaxen avatar Apr 08 '25 20:04 frerksaxen