[release/v7.4] Update the Update-Help tests to use -Force to remove read-only files (#26786)

Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
This commit is contained in:
Travis Plunk
2026-02-13 11:44:40 -05:00
committed by GitHub
co-authored by Dongbo Wang
parent 8bd316fb35
commit 84c8a2d3ac
@@ -215,17 +215,19 @@ function RunUpdateHelpTests
It ('Validate Update-Help for module ''{0}'' in {1}' -F $moduleName, [PSCustomObject] $updateScope) -Skip:(!(Test-CanWriteToPsHome) -and $userscope -eq $false) {
# Delete the whole help directory
Remove-Item ($moduleHelpPath) -Recurse
Remove-Item ($moduleHelpPath) -Recurse -Force -ErrorAction SilentlyContinue
[hashtable] $UICultureParam = $(if ((Get-UICulture).Name -ne $myUICulture) { @{ UICulture = $myUICulture } } else { @{} })
[hashtable] $sourcePathParam = $(if ($useSourcePath) { @{ SourcePath = Join-Path $PSScriptRoot assets } } else { @{} })
Update-Help -Module:$moduleName -Force @UICultureParam @sourcePathParam -Scope:$updateScope
Update-Help -Module:$moduleName -Force @UICultureParam @sourcePathParam -Scope:$updateScope -ErrorAction Stop
[hashtable] $userScopeParam = $(if ($userscope) { @{ UserScope = $true } } else { @{} })
ValidateInstalledHelpContent -moduleName:$moduleName @userScopeParam
}
if ($tag -eq "CI")
{
break