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?