File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,27 @@ Describe "Test importing customized rules with null return results" {
2222}
2323
2424Describe " Test importing correct customized rules" {
25+
26+ Context " Test Get-Help functionality in ScriptRule parsing logic" {
27+ It " ScriptRule help section must be correctly processed when Get-Help is called for the first time" {
28+
29+ # Force Get-Help to prompt for interactive input to download help using Update-Help
30+ # By removing this registry key we force to turn on Get-Help interactivity logic during ScriptRule parsing
31+ $null , " Wow6432Node" | ForEach-Object {
32+ try
33+ {
34+ Remove-ItemProperty - Name " DisablePromptToUpdateHelp" - Path " HKLM:\SOFTWARE\$ ( $_ ) \Microsoft\PowerShell" - ErrorAction Stop
35+ } catch {
36+ # Ignore for cases when tests are running in non-elevated more or registry key does not exist or not accessible
37+ }
38+ }
39+
40+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomizedRulePath $directory \samplerule\samplerule.psm1 | Where-Object {$_.Message -eq $message }
41+ $customizedRulePath.Count | Should Be 1
42+ }
43+
44+ }
45+
2546 Context " Test Get-ScriptAnalyzer with customized rules" {
2647 It " will show the customized rule" {
2748 $customizedRulePath = Get-ScriptAnalyzerRule - CustomizedRulePath $directory \samplerule\samplerule.psm1 | Where-Object {$_.RuleName -eq $measure }
You can’t perform that action at this time.
0 commit comments