Skip to content

Commit cf9daeb

Browse files
daxian-dbwTravisEz13
authored andcommitted
Update the Update-Help tests to use -Force to remove read-only files (PowerShell#26780)
1 parent 8bd316f commit cf9daeb

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

test/powershell/engine/Help/UpdatableHelpSystem.Tests.ps1

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,19 @@ function RunUpdateHelpTests
215215
It ('Validate Update-Help for module ''{0}'' in {1}' -F $moduleName, [PSCustomObject] $updateScope) -Skip:(!(Test-CanWriteToPsHome) -and $userscope -eq $false) {
216216

217217
# Delete the whole help directory
218-
Remove-Item ($moduleHelpPath) -Recurse
219-
218+
Remove-Item ($moduleHelpPath) -Recurse -Force -ErrorAction SilentlyContinue
219+
220220
[hashtable] $UICultureParam = $(if ((Get-UICulture).Name -ne $myUICulture) { @{ UICulture = $myUICulture } } else { @{} })
221221
[hashtable] $sourcePathParam = $(if ($useSourcePath) { @{ SourcePath = Join-Path $PSScriptRoot assets } } else { @{} })
222-
Update-Help -Module:$moduleName -Force @UICultureParam @sourcePathParam -Scope:$updateScope
222+
Update-Help -Module:$moduleName -Force @UICultureParam @sourcePathParam -Scope:$updateScope -ErrorAction Stop
223223

224224
[hashtable] $userScopeParam = $(if ($userscope) { @{ UserScope = $true } } else { @{} })
225225
ValidateInstalledHelpContent -moduleName:$moduleName @userScopeParam
226226

227+
227228
}
228229

230+
229231
if ($tag -eq "CI")
230232
{
231233
break
@@ -457,4 +459,4 @@ Describe "Validate 'Save-Help -DestinationPath for all PowerShell modules." -Tag
457459
$ProgressPreference = $SavedProgressPreference
458460
}
459461
RunSaveHelpTests -Tag "Feature"
460-
}
462+
}

0 commit comments

Comments
 (0)