Skip to content

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

Open
@frerksaxen

Description

@frerksaxen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions