Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test verbose
  • Loading branch information
MariusStorhaug committed Apr 14, 2024
commit 39c7d00bfb72ccbb93e2a5ef7eda5e68acba510f
5 changes: 2 additions & 3 deletions scripts/tests/PSModule/SourceCode.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,15 @@ Describe 'PSModule - SourceCode tests' {

# It 'All script files have tests' {} # Look for the folder name in tests called the same as section/folder name of functions

It 'Should not contain a -Verbose switch which is not directly disabled using :$false' {
It "Should not contain '-Verbose' unless it is disabled using ':`$false' qualifier after it" {
$issues = @('')
$scriptFiles | ForEach-Object {
Select-String -Path $_.FullName -Pattern '-Verbose(?!\:\$false)' -AllMatches | ForEach-Object {
$issues += " - $($_.Path):L$($_.LineNumber)"
}

}
$issues -join [Environment]::NewLine |
Should -BeNullOrEmpty -Because 'the script should not contain a -Verbose switch which is not directly disabled using :$false'
Should -BeNullOrEmpty -Because "the script should not contain '-Verbose' unless it is disabled using ':`$false' qualifier after it."
}
}

Expand Down