Skip to content

Example does not work #7

@nohwnd

Description

@nohwnd

Running the second example yields lot of these errors:

PS C:\Projects\PSTMigration> dir *.ps1 | New-Guard -TestPath {"./Tests/$($_.basename).Tests.ps1"}
Resolve-Path : Cannot evaluate parameter 'Path' because its argument is specified as a script block and there is no
input. A script block cannot be evaluated without input.
At C:\Projects\PowerShellGuard\PowerShellGuard.psm1:52 char:33
+       $TestPath = (resolve-path $TestPath).Path
+                                 ~~~~~~~~~
    + CategoryInfo          : MetadataError: (:) [Resolve-Path], ParameterBindingException
    + FullyQualifiedErrorId : ScriptBlockArgumentNoInput,Microsoft.PowerShell.Commands.ResolvePathCommand

Adding ValueFromPipeline=$true to $Path does not solve the issue, it only changes the error to:

Resolve-Path : Cannot evaluate parameter 'Path' because its argument is specified as a script block and there is no
input. A script block cannot be evaluated without input.
At C:\Projects\PowerShellGuard\PowerShellGuard.psm1:52 char:33
+       $TestPath = (resolve-path $TestPath).Path
+                                 ~~~~~~~~~
    + CategoryInfo          : MetadataError: (:) [Resolve-Path], ParameterBindingException
    + FullyQualifiedErrorId : ScriptBlockArgumentNoInput,Microsoft.PowerShell.Commands.ResolvePathCommand

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