File tree 3 files changed +17
-8
lines changed
3 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -121,9 +121,10 @@ Describe "Test ScriptDefinition" {
121
121
Describe " Test Path" {
122
122
Context " When given a single file" {
123
123
It " Has the same effect as without Path parameter" {
124
- $withPath = Invoke-ScriptAnalyzer $directory \TestScript.ps1
125
- $withoutPath = Invoke-ScriptAnalyzer - Path $directory \TestScript.ps1
126
- $withPath.Count -eq $withoutPath.Count | Should - BeTrue
124
+ $scriptPath = Join-Path $directory " TestScript.ps1"
125
+ $withPath = Invoke-ScriptAnalyzer $scriptPath
126
+ $withoutPath = Invoke-ScriptAnalyzer - Path $scriptPath
127
+ $withPath.Count | Should - Be $withoutPath.Count
127
128
}
128
129
129
130
It " Runs rules on script with more than 10 parser errors" {
Original file line number Diff line number Diff line change @@ -139,8 +139,12 @@ Describe "Resolve DSC Resource Dependency" {
139
139
140
140
Context " Invoke-ScriptAnalyzer without switch" {
141
141
It " Has parse errors" - skip:$skipTest {
142
- $dr = Invoke-ScriptAnalyzer - Path $violationFilePath - ErrorVariable parseErrors - ErrorAction SilentlyContinue
143
- $parseErrors.Count | Should - Be 1
142
+ $dr = Invoke-ScriptAnalyzer - Path $violationFilePath - ErrorVariable analyzerErrors - ErrorAction SilentlyContinue
143
+ $analyzerErrors.Count | Should - Be 0
144
+
145
+ $dr |
146
+ Where-Object { $_.Severity -eq " ParseError" } |
147
+ Get-Count | Should - Be 1
144
148
}
145
149
}
146
150
@@ -182,10 +186,13 @@ Describe "Resolve DSC Resource Dependency" {
182
186
Copy-Item - Recurse - Path $modulePath - Destination $tempModulePath
183
187
}
184
188
185
- It " Doesn't have parse errors " - skip:$skipTest {
189
+ It " has a single parse error " - skip:$skipTest {
186
190
# invoke script analyzer
187
- $dr = Invoke-ScriptAnalyzer - Path $violationFilePath - ErrorVariable parseErrors - ErrorAction SilentlyContinue
188
- $dr.Count | Should - Be 0
191
+ $dr = Invoke-ScriptAnalyzer - Path $violationFilePath - ErrorVariable analyzerErrors - ErrorAction SilentlyContinue
192
+ $analyzerErrors.Count | Should - Be 0
193
+ $dr |
194
+ Where-Object { $_.Severity -eq " ParseError" } |
195
+ Get-Count | Should - Be 1
189
196
}
190
197
191
198
It " Keeps PSModulePath unchanged before and after invocation" - skip:$skipTest {
Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ Configuration Sample_ChangeDescriptionAndPermissions
127
127
# SilentlyContinue
128
128
Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings - ErrorAction SilentlyContinue |
129
129
Get-Count |
130
+ Where-Object { $_.Severity -ne " ParseError" } |
130
131
Should - Be 4
131
132
}
132
133
}
You can’t perform that action at this time.
0 commit comments