1

We have a directory structure of modules like the following:

C:\Program Files\WindowsPowerShell\Modules\Toolbox.CustomModule1
C:\Program Files\WindowsPowerShell\Modules\Toolbox.CustomModule2
C:\Program Files\WindowsPowerShell\Modules\ModuleDownloaded
C:\Program Files\WindowsPowerShell\Modules\ModuleDownloadedOther

All PowerShell modules starting with 'Toolbox.' are the ones we created and are the only ones that need to be tested with Pester 5. I was hoping it would be possible to use a wildcard:

$config = [PesterConfiguration]@{
    Run = @{
        Path = "C:\Program Files\WindowsPowerShell\Modules\Toolbox.*"
    }
}
Invoke-Pester -Configuration $config

But the above fails because wildcards are not supported in Path. Using only C:\Program Files\WindowsPowerShell\Modules fails too due to downloaded modules that are not compatible with Pester 5. So hunting down the documentation I stumbled upon this:

$test = [PesterConfiguration]::Default
$test.Filter | Format-List

Tag : Tags of Describe, Context or It to be run. (System.String[], default: System.String[]) ExcludeTag : Tags of Describe, Context or It to be excluded from the run. (System.String[], default: System.String[]) Line : Filter by file and scriptblock start line, useful to run parsed tests programatically to avoid problems with expanded names. Example: 'C:\tests\file1.Tests.ps1:37' (System.String[], default: System.String[]) FullName : Full name of test with -like wildcards, joined by dot. Example: '*.describe Get-Item.test1' (System.String[], default: System.String[])

But that doesn't seem to talk about full file names. Is there a simple way to do this (instead of a simple foreach but from within the PesterConfiguration itself?

DarkLite1
  • 13,637
  • 40
  • 117
  • 214
  • Did you find a workaround in the meantime for this? Another solution you could use temporarily would be to use Get-ChildItem with the wildcard and load those into Path in the configuration object as the Path object accepts arrays of values. – Efie Mar 10 '21 at 01:06

1 Answers1

0

Seems to be a bug in Pester 5.1. Wildcards are supported and it will be fixed with the new release.

DarkLite1
  • 13,637
  • 40
  • 117
  • 214