Skip to content

Sub-optimal test names in Pester tests #1975

Description

@SamErde

This is specific to Pester v6, so you could pin v5 using -MaximumVersion 5.99.

Pester v6 formats objects in errors, name expressions etc, while v5 used a simple string cast for most objects. This uncovered a few sub-optimal test names in your repo like the ones in Common.Tests.ps1 referencing a full CommandInfo-object instead of the function name. Pester gets stuck trying to recurse the large object with many properties up to 10 levels depth.

It "<function>.ps1 should exist in public folder" {

Solution: Update tests names to reference the name like It "<function.name>.ps1 ...."

We will implement a fix in Pester (see pester/Pester#2865) but the new test-names might become [Management.Automation.FunctionInfo] should ..., so you should update the test names anyways to be explicit with what you want 🙂

Originally posted by @fflaten in #1928 (comment)

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