Skip to content

Verification for auto-generation synopsis is not correct (?) #1

@it-praktyk

Description

@it-praktyk

Under work for updating help for Pester module I discovered that part of your tests is not correct.

The file PesterTestsForHelp/InModule.Help.Tests.ps1 contains the test for auto-generated synopsis

# If help is not found, synopsis in auto-generated help is the syntax diagramIt "should not be auto-generated" {
    (Get-Help $command -ErrorAction SilentlyContinue).Synopsis | Should Not BeLike '*`[`<CommonParameters`>`]*'
}

https://github.com/juneb/PowerShellHelpDeepDive/blob/master/PesterTestsForHelp/InModule.Help.Tests.ps1#L48-L51
but autogenerated synopsis has the different pattern.

PS > Function test1 { param($param1)}
PS > Function test2 { }

PS > (Get-Help test1 -Full).Synopsis
test1 [[-param1] <Object>]

PS > (Get-Help test2 -Full).Synopsis
test2

For the function saved in the file with declared comment based help if '.SYNOPSIS' is not filled the value $null is returned.

As the result the test is passed even for the function what looks like

function Get-TestDriveItem {
    #moved here from Pester.psm1
    param( [string]$Path )

    Assert-DescribeInProgress -CommandName Get-TestDriveItem
    & $SafeCommands['Get-Item'] $(& $SafeCommands['Join-Path'] $TestDrive $Path )
}

https://github.com/pester/Pester/blob/master/Functions/TestDrive.ps1#L48-L54

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions