@@ -198,7 +198,7 @@ Task SetupHelpForTests {
198198 # Only commands in Microsoft.PowerShell.Archive can be tested for help so as to minimize the repository storage.
199199 # This requires admin rights for PS5.1
200200
201- # NOTE: You can run this task once as admin or update help separately, and continue to run tests as non-admin, if for instance developing locally.
201+ # NOTE: You can run this task once as admin or update help separately, and continue to run tests as non-admin, if for instance developing locally.
202202
203203 $installHelpScript = {
204204 param (
@@ -212,7 +212,7 @@ Task SetupHelpForTests {
212212 }
213213
214214 if ((Get-Help Expand-Archive ).remarks -notlike ' Get-Help cannot find the Help files*' ) {
215- Write-Host - Fore Green " PowerShell $PSVersion Archive Help is already installed"
215+ Write-Host - ForegroundColor Green " PowerShell $PSVersion Archive help is already installed"
216216 return
217217 }
218218
@@ -223,11 +223,11 @@ Task SetupHelpForTests {
223223 ).IsInRole(
224224 [Security.Principal.WindowsBuiltInRole ]::Administrator
225225 )) {
226- throw ' Windows PowerShell Update-Help requires admin rights. Please re-run the script in an elevated powershell session. '
226+ throw ' Windows PowerShell Update-Help requires admin rights. Please re-run the script in an elevated PowerShell session! '
227227 }
228228 }
229229
230- Write-Host - Fore Magenta " Powershell $PSVersion Archive Help is not installed, installing from $helpPath "
230+ Write-Host - ForegroundColor Magenta " PowerShell $PSVersion Archive help is not installed, installing from $helpPath "
231231
232232 $updateHelpParams = @ {
233233 Module = ' Microsoft.PowerShell.Archive'
@@ -237,42 +237,42 @@ Task SetupHelpForTests {
237237 Verbose = $true
238238 }
239239
240- # PS7+ does not require admin rights if currentuser is used for scope. 5 .1 does not have this option.
240+ # PS7+ does not require admin rights if CurrentUser is used for scope. PS5 .1 does not have this option.
241241 if ($PSEdition -ne ' Desktop' ) {
242242 $updateHelpParams .' Scope' = ' CurrentUser'
243243 }
244- # Update the help, and capture verbose output
244+ # Update the help and capture verbose output
245245 $updateHelpOutput = Update-Help @updateHelpParams * > & 1
246246
247247 if ((Get-Help Expand-Archive ).remarks -like ' Get-Help cannot find the Help files*' ) {
248248 throw " Failed to install PowerShell $PSVersion Help: $updateHelpOutput "
249249 } else {
250- Write-Host - Fore Green " Powershell $PSVersion Archive Help installed successfully"
250+ Write-Host - ForegroundColor Green " PowerShell $PSVersion Archive help installed successfully"
251251 }
252252 }
253253
254- # Need this to inject the help file path, since PSScriptRoot won't work inside the script
254+ # Need this to inject the help file path since PSScriptRoot won't work inside the script
255255 $helpPath = Resolve-Path " $PSScriptRoot \test\PowerShellEditorServices.Test.Shared\PSHelp" - ErrorAction Stop
256- Write-Host - Fore Magenta " Runner Help located at $helpPath "
256+ Write-Build DarkMagenta " Runner help located at $helpPath "
257257
258258 if (Get-Command powershell.exe - CommandType Application - ea 0 ) {
259- Write-Host - Fore Magenta ' Checking PowerShell 5.1 help'
259+ Write-Build DarkMagenta ' Checking PowerShell 5.1 help'
260260 & powershell.exe - NoProfile - NonInteractive - Command $installHelpScript - args $helpPath
261261 if ($LASTEXITCODE -ne 0 ) {
262- throw ' Failed to install PowerShell 5.1 Help. '
262+ throw ' Failed to install PowerShell 5.1 help! '
263263 }
264264 }
265265
266266 if ($PwshDaily -and (Get-Command $PwshDaily - ea 0 )) {
267- Write-Host - Fore Magenta " Checking PWSH Daily help at $PwshDaily "
267+ Write-Build DarkMagenta " Checking PowerShell Daily help at $PwshDaily "
268268 Invoke-BuildExec { & $PwshDaily - NoProfile - NonInteractive - Command $installHelpScript - args $helpPath }
269269 if ($LASTEXITCODE -ne 0 ) {
270- throw ' Failed to install PowerShell Daily Help. '
270+ throw ' Failed to install PowerShell Daily help! '
271271 }
272272 }
273273
274274 if ($PSEdition -eq ' Core' ) {
275- Write-Host - Fore Magenta ' Checking Runner Pwsh help '
275+ Write-Build DarkMagenta " Checking this PowerShell process's help "
276276 & $installHelpScript $helpPath
277277 }
278278}
0 commit comments