Skip to content

Commit bc3cdb0

Browse files
committed
Cleaned up more warnings in tests
1 parent 028af94 commit bc3cdb0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Tests/Engine/CustomizedRule.tests.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ if (!(Get-Module PSScriptAnalyzer) -and !$testingLibraryUsage)
66
Import-Module PSScriptAnalyzer
77
}
88

9+
# Force Get-Help not to prompt for interactive input to download help using Update-Help
10+
# By adding this registry key we turn off Get-Help interactivity logic during ScriptRule parsing
11+
$null,"Wow6432Node" | ForEach-Object {
12+
try
13+
{
14+
Set-ItemProperty -Name "DisablePromptToUpdateHelp" -Path "HKLM:\SOFTWARE\$($_)\Microsoft\PowerShell" -Value 1 -Force
15+
}
16+
catch
17+
{
18+
# Ignore for cases when tests are running in non-elevated more or registry key does not exist or not accessible
19+
}
20+
921
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
1022
$message = "this is help"
1123
$measure = "Measure-RequiresRunAsAdministrator"
@@ -48,7 +60,7 @@ Describe "Test importing correct customized rules" {
4860
$customizedRulePath.Count | Should Be 1
4961

5062
# Force Get-Help not to prompt for interactive input to download help using Update-Help
51-
# By adding this registry key we force to turn off Get-Help interactivity logic during ScriptRule parsing
63+
# By adding this registry key we turn off Get-Help interactivity logic during ScriptRule parsing
5264
$null,"Wow6432Node" | ForEach-Object {
5365
try
5466
{

0 commit comments

Comments
 (0)