I wrote a pester test to check that certain folders and files exist. The pester test works great but I wanted to include suggestions for fixes if the test is called with the -Verbose option. But I can't seem to get the -Verbose parameter to the actual test.
Folder/File structure:
Custom-PowerShellModule
| Custom-PowerShellModule.psd1
| Custom-PowerShellModule.psm1
\---Tests
Module.Tests.ps1
Below is just the top part of pester test:
$Here = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
Describe "Module Minimum Requirements Tests. Use -Verbose for Suggested Fixes" -Tags Module {
Context "Test: Verify File Counts = 1" {
Write-Verbose "If you receive an error, verify there is only 'ONE' PSD1 File and only 'ONE' PSM1 File."
It "There is only one PSD1 file" { (Get-ChildItem "$Here\..\" *.psd1).count | Should be 1 }
It "There is only one PSM1 file" { (Get-ChildItem "$Here\..\" *.psm1).count | Should be 1 }
}
}