Skip to content

PesterThrow scriptblock won't redirect to null when testing PowerShell DSC exception handling #160

@anweiss

Description

@anweiss

The code in lines 11-13 of PesterThrow.ps1 (https://github.com/pester/Pester/blob/Beta/Functions/Assertions/PesterThrow.ps1#L11-L13) fails to redirect output to $null when testing PowerShell DSC exception handling. This subsequently causes the output to enter the pipeline and possibly break the test. Also, when a DSC exception is thrown by the user, multiple ErrorRecord objects are sent to the pipeline; a RuntimeException, which represents the user generated throw as well as a FailToProcessConfiguration exception that DSC throws. This prevents Pester from evaluating whether or not the exception's message is as asserted.

My proposal is to redirect all output to $null using *> $null.

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