Skip to content

Should-Throw makes -Because positional, it should be named only #2932

Description

@nohwnd

Every assertion takes -Because as a named parameter, except Should-Throw, where Because is [Parameter(Position = 3)]. So Should-Throw msg errorid type reason binds the fourth positional argument to Because, which is inconsistent with the rest and easy to hit by accident.

Make -Because named only in Should-Throw, like the other assertions.

This changes positional binding, so it is technically breaking, but the new assertions are new in 6.0.0 and I think it is fine to align them in 6.1.0.

Part of the new Should-* assertion consistency audit, see #2874.

🤖

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions