pester.ps1
# Retrieve the scripts of the functions to test $functionScripts = Get-ChildItem @("$($PSScriptRoot)\Functions", "$($PSScriptRoot)\PrivateFunctions") -Include "*.ps1" -Exclude "*.Tests.ps1" -Recurse # Invoke Pester $pesterOutput = Invoke-Pester @("$($PSScriptRoot)\Functions", "$($PSScriptRoot)\PrivateFunctions") -CodeCoverage $functionScripts -PassThru # Output the important information at the end Write-Host "Tests Passed: $($pesterOutput.PassedCount), Failed: $($pesterOutput.FailedCount)" Write-Host "Code coverage: $($pesterOutput.CodeCoverage.NumberOfCommandsExecuted / $pesterOutput.CodeCoverage.NumberOfCommandsAnalyzed * 100)%" |