File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -101,8 +101,18 @@ Configuration MyDscConfiguration {
101
101
}
102
102
103
103
It " do not warn when about Get-* completed cmdlets when the command exists natively on Unix platforms" - skip:(-not ($IsLinux -or $IsMacOS )) {
104
- $violations = Invoke-ScriptAnalyzer - IncludeRule PSAvoidUsingCmdletAliases - ExcludeRule PSUseCompatibleCommands - ScriptDefinition ' date' | Where-Object { $_.RuleName -eq $violationName }
105
- $violations [0 ].Message | Should - Be ' '
104
+ $nativeLinuxCommand = ' date'
105
+ $dateCommand = Get-Command $nativeLinuxCommand - CommandType Application - ErrorAction Ignore
106
+
107
+ $violations = Invoke-ScriptAnalyzer - IncludeRule PSAvoidUsingCmdletAliases - ExcludeRule PSUseCompatibleCommands - ScriptDefinition $nativeLinuxCommand | Where-Object { $_.RuleName -eq $violationName }
108
+
109
+ $expectedViolations = 1
110
+ if ($dateCommand )
111
+ {
112
+ $expectedViolations = 0
113
+ }
114
+
115
+ $violations.Count | Should - Be $expectedViolations
106
116
}
107
117
}
108
118
}
You can’t perform that action at this time.
0 commit comments