Skip to content

Commit 67a6c4e

Browse files
author
Kapil Borle
committed
Fix tests for PSv3
1 parent e8db887 commit 67a6c4e

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

Tests/Engine/CustomizedRule.tests.ps1

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,24 +196,20 @@ Describe "Test importing correct customized rules" {
196196
$customizedRulePath.Count | Should Be 1
197197
}
198198

199-
if ($PSVersionTable.PSVersion -lt [Version]'5.0.0')
200-
{
201-
It "loads custom rules that contain version in their path" {
199+
It "loads custom rules that contain version in their path" -Skip:($PSVersionTable.PSVersion -lt [Version]'5.0.0') {
202200
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomRulePath $directory\VersionedSampleRule\SampleRuleWithVersion
203201
$customizedRulePath.Count | Should Be 1
204202

205203
$customizedRulePath = Get-ScriptAnalyzerRule -CustomRulePath $directory\VersionedSampleRule\SampleRuleWithVersion
206204
$customizedRulePath.Count | Should Be 1
207205
}
208206

209-
It "loads custom rules that contain version in their path with the RecurseCustomRule switch" {
207+
It "loads custom rules that contain version in their path with the RecurseCustomRule switch" -Skip:($PSVersionTable.PSVersion -lt [Version]'5.0.0') {
210208
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomRulePath $directory\VersionedSampleRule -RecurseCustomRulePath
211209
$customizedRulePath.Count | Should Be 1
212210

213211
$customizedRulePath = Get-ScriptAnalyzerRule -CustomRulePath $directory\VersionedSampleRule -RecurseCustomRulePath
214212
$customizedRulePath.Count | Should Be 1
215-
216-
}
217213
}
218214
}
219215

Tests/Engine/RuleSuppression.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function SuppressPwdParam()
103103
}
104104

105105
Context "Rule suppression within DSC Configuration definition" {
106-
It "Suppresses rule" -skip:((Test-PSEditionCoreCLRLinux) -or ($PSVersionTable.PSVersion -ge [Version]'5.0.0')) {
106+
It "Suppresses rule" -skip:((Test-PSEditionCoreCLRLinux) -or ($PSVersionTable.PSVersion -lt [Version]'5.0.0')) {
107107
$suppressedRule = Invoke-ScriptAnalyzer -ScriptDefinition $ruleSuppressionInConfiguration -SuppressedOnly
108108
$suppressedRule.Count | Should Be 1
109109
}

0 commit comments

Comments
 (0)