Skip to content

Commit d30678d

Browse files
committed
Script Analyser raised issues for Warnings
1 parent 7a89e75 commit d30678d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/QA/module.tests.ps1

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,10 @@ Describe 'Quality for module' -Tags 'TestQuality' {
134134
It 'Should pass Script Analyzer for <Name>' -ForEach ($testCases | Where-Object { $_.Name -in $mut.ExportedCommands.Values.Name }) -Skip:(-not $scriptAnalyzerRules) {
135135
$functionFile = Get-ChildItem -Path $sourcePath -Recurse -Include "$Name.ps1"
136136

137-
$pssaResult = (Invoke-ScriptAnalyzer -Path $functionFile.FullName)
138-
$report = $pssaResult | Format-Table -AutoSize | Out-String -Width 110
139-
$pssaResult | Should -BeNullOrEmpty -Because `
140-
"some rule triggered.`r`n`r`n $report"
141-
}
137+
$Result = (Invoke-ScriptAnalyzer -Path $functionFile.FullName)
138+
$report = $Result | Format-Table -AutoSize | Out-String -Width 110
139+
$Errors = if ($Result) { $Result | Where-Object { $_.Severity -ne 'Warning' } } else { @() }
140+
$Errors | Should -BeNullOrEmpty -Because "some rule triggered.`r`n`r`n $report" }
142141
}
143142

144143
Describe 'Help for module' -Tags 'helpQuality' {

0 commit comments

Comments
 (0)