Skip to content

Commit b1c40cd

Browse files
bergmeisterChristoph Bergmeister
and
Christoph Bergmeister
authored
Replace usage of $MyInvocation.MyCommand.Path with $PSScriptRoot and cleanup tests as a preparation for Pester v5 (#1438)
* Replace usage of $MyInvocation.MyCommand.Pat with $PSScriptRoot and cleanup tests * Fix 2 small mistakes, test should now be green again * remove redundant [bool] before $IsCoreCLR and make casing consistent Co-authored-by: Christoph Bergmeister <christoph.bergmeister@bjss.com>
1 parent 03aa085 commit b1c40cd

File tree

61 files changed

+275
-365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+275
-365
lines changed

Tests/Documentation/RuleDocumentation.tests.ps1

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
2-
$testRootDirectory = Split-Path -Parent $directory
3-
$repoRootDirectory = Split-Path -Parent $testRootDirectory
4-
$ruleDocDirectory = Join-Path $repoRootDirectory RuleDocumentation
5-
61
Describe "Validate rule documentation files" {
72
BeforeAll {
3+
$ruleDocDirectory = Join-Path $PSScriptRoot '../../RuleDocumentation'
84
$docs = Get-ChildItem $ruleDocDirectory/*.md -Exclude README.md |
95
ForEach-Object { "PS" + $_.BaseName} | Sort-Object
106

@@ -56,7 +52,7 @@ Describe "Validate rule documentation files" {
5652
$filePath | Should -Exist
5753
}
5854
}
59-
55+
6056
It "Every rule name in the rule documentation README.md file must match the documentation file's basename" {
6157
foreach ($key in $readmeLinks.Keys) {
6258
$link = $readmeLinks[$key]

Tests/Engine/CustomizedRule.tests.ps1

+37-48
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
2-
$testRootDirectory = Split-Path -Parent $directory
3-
Import-Module (Join-Path $testRootDirectory 'PSScriptAnalyzerTestHelper.psm1')
4-
5-
if (-not (Test-PSEditionCoreCLR))
1+
if (-not $IsCoreCLR)
62
{
73
# Force Get-Help not to prompt for interactive input to download help using Update-Help
84
# By adding this registry key we turn off Get-Help interactivity logic during ScriptRule parsing
@@ -25,15 +21,15 @@ $measure = "Measure-RequiresRunAsAdministrator"
2521
Describe "Test importing customized rules with null return results" {
2622
Context "Test Get-ScriptAnalyzer with customized rules" {
2723
It "will not terminate the engine" {
28-
$customizedRulePath = Get-ScriptAnalyzerRule -CustomizedRulePath $directory\samplerule\SampleRulesWithErrors.psm1 | Where-Object {$_.RuleName -eq $measure}
24+
$customizedRulePath = Get-ScriptAnalyzerRule -CustomizedRulePath $PSScriptRoot\samplerule\SampleRulesWithErrors.psm1 | Where-Object {$_.RuleName -eq $measure}
2925
$customizedRulePath.Count | Should -Be 1
3026
}
3127

3228
}
3329

3430
Context "Test Invoke-ScriptAnalyzer with customized rules" {
3531
It "will not terminate the engine" {
36-
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomizedRulePath $directory\samplerule\SampleRulesWithErrors.psm1 | Where-Object {$_.RuleName -eq $measure}
32+
$customizedRulePath = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -CustomizedRulePath $PSScriptRoot\samplerule\SampleRulesWithErrors.psm1 | Where-Object {$_.RuleName -eq $measure}
3733
$customizedRulePath.Count | Should -Be 0
3834
}
3935
}
@@ -42,7 +38,7 @@ Describe "Test importing customized rules with null return results" {
4238

4339
Describe "Test importing correct customized rules" {
4440

45-
if(-not (Test-PSEditionCoreCLR))
41+
if(-not $IsCoreCLR)
4642
{
4743
Context "Test Get-Help functionality in ScriptRule parsing logic" {
4844
It "ScriptRule help section must be correctly processed when Get-Help is called for the first time" {
@@ -58,7 +54,7 @@ Describe "Test importing correct customized rules" {
5854
}
5955
}
6056

61-
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomizedRulePath $directory\samplerule\samplerule.psm1 | Where-Object {$_.Message -eq $message}
57+
$customizedRulePath = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -CustomizedRulePath $PSScriptRoot\samplerule\samplerule.psm1 | Where-Object {$_.Message -eq $message}
6258
$customizedRulePath.Count | Should -Be 1
6359

6460
# Force Get-Help not to prompt for interactive input to download help using Update-Help
@@ -79,70 +75,65 @@ Describe "Test importing correct customized rules" {
7975

8076
Context "Test Get-ScriptAnalyzer with customized rules" {
8177
It "will show the custom rule" {
82-
$customizedRulePath = Get-ScriptAnalyzerRule -CustomizedRulePath $directory\samplerule\samplerule.psm1 | Where-Object {$_.RuleName -eq $measure}
78+
$customizedRulePath = Get-ScriptAnalyzerRule -CustomizedRulePath $PSScriptRoot\samplerule\samplerule.psm1 | Where-Object {$_.RuleName -eq $measure}
8379
$customizedRulePath.Count | Should -Be 1
8480
}
8581

8682
It "will show the custom rule when given a rule folder path" {
87-
$customizedRulePath = Get-ScriptAnalyzerRule -CustomizedRulePath $directory\samplerule | Where-Object {$_.RuleName -eq $measure}
83+
$customizedRulePath = Get-ScriptAnalyzerRule -CustomizedRulePath $PSScriptRoot\samplerule | Where-Object {$_.RuleName -eq $measure}
8884
$customizedRulePath.Count | Should -Be 1
8985
}
9086

9187
It "will show the custom rule when given a rule folder path with trailing backslash" -skip:$($IsLinux -or $IsMacOS) {
92-
$customizedRulePath = Get-ScriptAnalyzerRule -CustomizedRulePath $directory/samplerule/ | Where-Object {$_.RuleName -eq $measure}
88+
$customizedRulePath = Get-ScriptAnalyzerRule -CustomizedRulePath $PSScriptRoot/samplerule/ | Where-Object {$_.RuleName -eq $measure}
9389
$customizedRulePath.Count | Should -Be 1
9490
}
9591

9692
It "will show the custom rules when given a glob" {
97-
# needs fixing for Linux
98-
$expectedNumRules = 4
99-
$customizedRulePath = Get-ScriptAnalyzerRule -CustomizedRulePath $directory\samplerule\samplerule* | Where-Object {$_.RuleName -match $measure}
93+
$customizedRulePath = Get-ScriptAnalyzerRule -CustomizedRulePath $PSScriptRoot\samplerule\samplerule* | Where-Object {$_.RuleName -match $measure}
10094
$customizedRulePath.Count | Should -Be 4
10195
}
10296

10397
It "will show the custom rules when given recurse switch" {
104-
$customizedRulePath = Get-ScriptAnalyzerRule -RecurseCustomRulePath -CustomizedRulePath "$directory\samplerule", "$directory\samplerule\samplerule2" | Where-Object {$_.RuleName -eq $measure}
98+
$customizedRulePath = Get-ScriptAnalyzerRule -RecurseCustomRulePath -CustomizedRulePath "$PSScriptRoot\samplerule", "$PSScriptRoot\samplerule\samplerule2" | Where-Object {$_.RuleName -eq $measure}
10599
$customizedRulePath.Count | Should -Be 5
106100
}
107101

108102
It "will show the custom rules when given glob with recurse switch" {
109-
# needs fixing for Linux
110-
$expectedNumRules = 5
111-
$customizedRulePath = Get-ScriptAnalyzerRule -RecurseCustomRulePath -CustomizedRulePath $directory\samplerule\samplerule* | Where-Object {$_.RuleName -eq $measure}
103+
$customizedRulePath = Get-ScriptAnalyzerRule -RecurseCustomRulePath -CustomizedRulePath $PSScriptRoot\samplerule\samplerule* | Where-Object {$_.RuleName -eq $measure}
112104
$customizedRulePath.Count | Should -Be 5
113105
}
114106

115107
It "will show the custom rules when given glob with recurse switch" {
116-
$customizedRulePath = Get-ScriptAnalyzerRule -RecurseCustomRulePath -CustomizedRulePath $directory\samplerule* | Where-Object {$_.RuleName -eq $measure}
108+
$customizedRulePath = Get-ScriptAnalyzerRule -RecurseCustomRulePath -CustomizedRulePath $PSScriptRoot\samplerule* | Where-Object {$_.RuleName -eq $measure}
117109
$customizedRulePath.Count | Should -Be 3
118110
}
119111
}
120112

121113
Context "Test Invoke-ScriptAnalyzer with customized rules" {
122114
It "will show the custom rule in the results" {
123-
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomizedRulePath $directory\samplerule\samplerule.psm1 | Where-Object {$_.Message -eq $message}
115+
$customizedRulePath = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -CustomizedRulePath $PSScriptRoot\samplerule\samplerule.psm1 | Where-Object {$_.Message -eq $message}
124116
$customizedRulePath.Count | Should -Be 1
125117
}
126118

127119
It "will show the custom rule in the results when given a rule folder path" {
128-
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomizedRulePath $directory\samplerule | Where-Object {$_.Message -eq $message}
120+
$customizedRulePath = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -CustomizedRulePath $PSScriptRoot\samplerule | Where-Object {$_.Message -eq $message}
129121
$customizedRulePath.Count | Should -Be 1
130122
}
131123

132124
It "will set ScriptName property to the target file name" {
133-
$violations = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomizedRulePath $directory\samplerule
125+
$violations = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -CustomizedRulePath $PSScriptRoot\samplerule
134126
$violations[0].ScriptName | Should -Be 'TestScript.ps1'
135127
}
136128

137129
It "will set ScriptPath property to the target file path" {
138-
$violations = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomizedRulePath $directory\samplerule
139-
$expectedScriptPath = Join-Path $directory 'TestScript.ps1'
130+
$violations = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -CustomizedRulePath $PSScriptRoot\samplerule
131+
$expectedScriptPath = Join-Path $PSScriptRoot 'TestScript.ps1'
140132
$violations[0].ScriptPath | Should -Be $expectedScriptPath
141133
}
142134

143135
It "will set SuggestedCorrections" {
144-
$violations = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomizedRulePath $directory\samplerule
145-
$expectedScriptPath = Join-Path $directory 'TestScript.ps1'
136+
$violations = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -CustomizedRulePath $PSScriptRoot\samplerule
146137
$violations[0].SuggestedCorrections | Should -Not -BeNullOrEmpty
147138
$violations[0].SuggestedCorrections.StartLineNumber | Should -Be 1
148139
$violations[0].SuggestedCorrections.EndLineNumber | Should -Be 2
@@ -158,7 +149,7 @@ Describe "Test importing correct customized rules" {
158149
$testScriptPath = "TestDrive:\SuppressedCustomRule.ps1"
159150
Set-Content -Path $testScriptPath -Value $script
160151

161-
$customizedRulePath = Invoke-ScriptAnalyzer -Path $testScriptPath -CustomizedRulePath $directory\samplerule\samplerule.psm1 |
152+
$customizedRulePath = Invoke-ScriptAnalyzer -Path $testScriptPath -CustomizedRulePath $PSScriptRoot\samplerule\samplerule.psm1 |
162153
Where-Object { $_.Message -eq $message }
163154

164155
$customizedRulePath.Count | Should -Be 0
@@ -202,7 +193,7 @@ Describe "Test importing correct customized rules" {
202193
}
203194

204195
It "will set RuleSuppressionID" {
205-
$violations = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomizedRulePath $directory\samplerule
196+
$violations = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -CustomizedRulePath $PSScriptRoot\samplerule
206197
$violations[0].RuleSuppressionID | Should -Be "MyRuleSuppressionID"
207198
}
208199

@@ -212,63 +203,61 @@ Describe "Test importing correct customized rules" {
212203
# needs fixing for Linux
213204
if (!$IsLinux -and !$IsMacOS)
214205
{
215-
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomizedRulePath $directory\samplerule\ | Where-Object {$_.Message -eq $message}
206+
$customizedRulePath = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -CustomizedRulePath $PSScriptRoot\samplerule\ | Where-Object {$_.Message -eq $message}
216207
$customizedRulePath.Count | Should -Be 1
217208
}
218209
}
219210

220211
It "will show the custom rules when given a glob" {
221-
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomizedRulePath $directory\samplerule\samplerule* | Where-Object {$_.Message -eq $message}
212+
$customizedRulePath = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -CustomizedRulePath $PSScriptRoot\samplerule\samplerule* | Where-Object {$_.Message -eq $message}
222213
$customizedRulePath.Count | Should -Be 3
223214
}
224215

225216
It "will show the custom rules when given recurse switch" {
226-
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -RecurseCustomRulePath -CustomizedRulePath $directory\samplerule | Where-Object {$_.Message -eq $message}
217+
$customizedRulePath = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -RecurseCustomRulePath -CustomizedRulePath $PSScriptRoot\samplerule | Where-Object {$_.Message -eq $message}
227218
$customizedRulePath.Count | Should -Be 3
228219
}
229220

230221
It "will show the custom rules when given glob with recurse switch" {
231-
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -RecurseCustomRulePath -CustomizedRulePath $directory\samplerule\samplerule* | Where-Object {$_.Message -eq $message}
222+
$customizedRulePath = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -RecurseCustomRulePath -CustomizedRulePath $PSScriptRoot\samplerule\samplerule* | Where-Object {$_.Message -eq $message}
232223
$customizedRulePath.Count | Should -Be 4
233224
}
234225

235226
It "will show the custom rules when given glob with recurse switch" {
236-
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -RecurseCustomRulePath -CustomizedRulePath $directory\samplerule* | Where-Object {$_.Message -eq $message}
227+
$customizedRulePath = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -RecurseCustomRulePath -CustomizedRulePath $PSScriptRoot\samplerule* | Where-Object {$_.Message -eq $message}
237228
$customizedRulePath.Count | Should -Be 3
238229
}
239230

240231
It "Using IncludeDefaultRules Switch with CustomRulePath" {
241-
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomRulePath $directory\samplerule\samplerule.psm1 -IncludeDefaultRules
232+
$customizedRulePath = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -CustomRulePath $PSScriptRoot\samplerule\samplerule.psm1 -IncludeDefaultRules
242233
$customizedRulePath.Count | Should -Be 2
243234
}
244235

245236
It "Using IncludeDefaultRules Switch without CustomRulePath" {
246-
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -IncludeDefaultRules
237+
$customizedRulePath = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -IncludeDefaultRules
247238
$customizedRulePath.Count | Should -Be 1
248239
}
249240

250241
It "Not Using IncludeDefaultRules Switch and without CustomRulePath" {
251-
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1
242+
$customizedRulePath = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1
252243
$customizedRulePath.Count | Should -Be 1
253244
}
254245

255246
It "loads custom rules that contain version in their path" -Skip:($PSVersionTable.PSVersion -lt [Version]'5.0.0') {
256-
$customizedRulePath = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomRulePath $directory\VersionedSampleRule\SampleRuleWithVersion
257-
$customizedRulePath.Count | Should -Be 1
247+
$customizedRulePath = Invoke-ScriptAnalyzer $PSScriptRoot\TestScript.ps1 -CustomRulePath $PSScriptRoot\VersionedSampleRule\SampleRuleWithVersion
248+
$customizedRulePath.Count | Should -Be 1
258249

259-
$customizedRulePath = Get-ScriptAnalyzerRule -CustomRulePath $directory\VersionedSampleRule\SampleRuleWithVersion
260-
$customizedRulePath.Count | Should -Be 1
250+
$customizedRulePath = Get-ScriptAnalyzerRule -CustomRulePath $PSScriptRoot\VersionedSampleRule\SampleRuleWithVersion
251+
$customizedRulePath.Count | Should -Be 1
261252
}
262253

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

267-
$customizedRulePath = Get-ScriptAnalyzerRule -CustomRulePath $directory\VersionedSampleRule -RecurseCustomRulePath
268-
$customizedRulePath.Count | Should -Be 1
269-
}
258+
$customizedRulePath = Get-ScriptAnalyzerRule -CustomRulePath $PSScriptRoot\VersionedSampleRule -RecurseCustomRulePath
259+
$customizedRulePath.Count | Should -Be 1
260+
}
270261
}
271-
272262
}
273263
}
274-

Tests/Engine/EditableText.tests.ps1

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
2-
$testRootDirectory = Split-Path -Parent $directory
3-
1+
$testRootDirectory = Split-Path -Parent $PSScriptRoot
42
Import-Module (Join-Path $testRootDirectory "PSScriptAnalyzerTestHelper.psm1")
5-
63
$editableTextType = "Microsoft.Windows.PowerShell.ScriptAnalyzer.EditableText"
74
$textEditType = "Microsoft.Windows.PowerShell.ScriptAnalyzer.TextEdit"
85

96
Describe "EditableText class" {
10-
Context "When a sigle edit is given for application" {
7+
Context "When a single edit is given for application" {
118
It "Should replace in a single line string in the middle" {
129
$def = 'This is just a single line.'
1310
$edit = New-Object -TypeName $textEditType -ArgumentList 1,14,1,22,"one"
@@ -93,7 +90,6 @@ function foo {
9390
}
9491
'@
9592
# Editor does not allow trailing white-spaces, hence this weird construct.
96-
$s = ' '
9793
$newText = @"
9894
[CmdletBinding()]
9995

Tests/Engine/Extensions.tests.ps1

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
2-
$testRootDirectory = Split-Path -Parent $directory
1+
$testRootDirectory = Split-Path -Parent $PSScriptRoot
32
Import-Module (Join-Path $testRootDirectory "PSScriptAnalyzerTestHelper.psm1")
43

54
function Get-Extent {

Tests/Engine/GetScriptAnalyzerRule.tests.ps1

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
2-
$testRootDirectory = Split-Path -Parent $directory
1+
$testRootDirectory = Split-Path -Parent $PSScriptRoot
32
Import-Module (Join-Path $testRootDirectory 'PSScriptAnalyzerTestHelper.psm1')
43
$sa = Get-Command Get-ScriptAnalyzerRule
54

@@ -105,28 +104,28 @@ Describe "Test RuleExtension" {
105104
$expectedNumCommunityRules = 12
106105
}
107106
It "with the module folder path" {
108-
$ruleExtension = Get-ScriptAnalyzerRule -CustomizedRulePath $directory\CommunityAnalyzerRules | Where-Object {$_.SourceName -eq $community}
107+
$ruleExtension = Get-ScriptAnalyzerRule -CustomizedRulePath $PSScriptRoot\CommunityAnalyzerRules | Where-Object {$_.SourceName -eq $community}
109108
$ruleExtension.Count | Should -Be $expectedNumCommunityRules
110109
}
111110

112111
It "with the psd1 path" {
113-
$ruleExtension = Get-ScriptAnalyzerRule -CustomizedRulePath $directory\CommunityAnalyzerRules\CommunityAnalyzerRules.psd1 | Where-Object {$_.SourceName -eq $community}
112+
$ruleExtension = Get-ScriptAnalyzerRule -CustomizedRulePath $PSScriptRoot\CommunityAnalyzerRules\CommunityAnalyzerRules.psd1 | Where-Object {$_.SourceName -eq $community}
114113
$ruleExtension.Count | Should -Be $expectedNumCommunityRules
115114

116115
}
117116

118117
It "with the psm1 path" {
119-
$ruleExtension = Get-ScriptAnalyzerRule -CustomizedRulePath $directory\CommunityAnalyzerRules\CommunityAnalyzerRules.psm1 | Where-Object {$_.SourceName -eq $community}
118+
$ruleExtension = Get-ScriptAnalyzerRule -CustomizedRulePath $PSScriptRoot\CommunityAnalyzerRules\CommunityAnalyzerRules.psm1 | Where-Object {$_.SourceName -eq $community}
120119
$ruleExtension.Count | Should -Be $expectedNumCommunityRules
121120
}
122121

123122
It "with Name of a built-in rules" {
124-
$ruleExtension = Get-ScriptAnalyzerRule -CustomizedRulePath $directory\CommunityAnalyzerRules\CommunityAnalyzerRules.psm1 -Name $singularNouns
123+
$ruleExtension = Get-ScriptAnalyzerRule -CustomizedRulePath $PSScriptRoot\CommunityAnalyzerRules\CommunityAnalyzerRules.psm1 -Name $singularNouns
125124
$ruleExtension.Count | Should -Be 0
126125
}
127126

128127
It "with Names of built-in, DSC and non-built-in rules" {
129-
$ruleExtension = Get-ScriptAnalyzerRule -CustomizedRulePath $directory\CommunityAnalyzerRules\CommunityAnalyzerRules.psm1 -Name $singularNouns, $measureRequired, $dscIdentical
128+
$ruleExtension = Get-ScriptAnalyzerRule -CustomizedRulePath $PSScriptRoot\CommunityAnalyzerRules\CommunityAnalyzerRules.psm1 -Name $singularNouns, $measureRequired, $dscIdentical
130129
$ruleExtension.Count | Should -Be 1
131130
($ruleExtension | Where-Object {$_.RuleName -eq $measureRequired}).Count | Should -Be 1
132131
($ruleExtension | Where-Object {$_.RuleName -eq $singularNouns}).Count | Should -Be 0

0 commit comments

Comments
 (0)