mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
This commit is contained in:
+1
-1
@@ -83,7 +83,7 @@ try
|
||||
$result = Get-Command NestedFn1 2> $null;
|
||||
return ($result -ne $null)
|
||||
'@
|
||||
$isCommandAccessible = powershell.exe -noprofile -nologo -c $command
|
||||
$isCommandAccessible = pwsh.exe -noprofile -nologo -c $command
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -104,7 +104,24 @@ function Initialize
|
||||
|
||||
function Remove-InstalledModules
|
||||
{
|
||||
Get-InstalledModule -Name $TestModule -AllVersions -ErrorAction SilentlyContinue | PowerShellGet\Uninstall-Module -Force
|
||||
try {
|
||||
$mod = Get-InstalledModule -Name $TestModule -AllVersions -ErrorAction SilentlyContinue
|
||||
if ($null -eq $mod) {
|
||||
return
|
||||
}
|
||||
|
||||
if (Get-Module -Name $TestModule -ErrorAction Ignore) {
|
||||
Remove-Module -Force -Name $TestModule
|
||||
}
|
||||
|
||||
$installedPath = $mod.InstalledLocation
|
||||
if (Test-Path $installedPath) {
|
||||
Remove-Item -Force -Recurse $installedPath -ErrorAction Ignore
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Warning "Remove-InstalledModules: $_"
|
||||
}
|
||||
}
|
||||
|
||||
Describe "PowerShellGet - Module tests" -tags "Feature" {
|
||||
@@ -172,7 +189,20 @@ Describe "PowerShellGet - Module tests (Admin)" -Tags @('Feature', 'RequireAdmin
|
||||
|
||||
function Remove-InstalledScripts
|
||||
{
|
||||
Get-InstalledScript -Name $TestScript -ErrorAction SilentlyContinue | Uninstall-Script -Force
|
||||
$installedScript = Get-InstalledScript -Name $TestScript -ErrorAction SilentlyContinue
|
||||
if ($null -eq $installedScript) {
|
||||
return
|
||||
}
|
||||
|
||||
$scriptPath = Join-Path ${installedScript}.InstalledLocation "${TestScript}.ps1"
|
||||
if (test-Path -Type Leaf -Path $scriptPath) {
|
||||
Remove-Item -Force -Path $scriptPath -ErrorAction Ignore
|
||||
}
|
||||
|
||||
$xmlPath = Join-Path ${installedScript}.InstalledLocation InstalledScriptInfos "${TestScript}_InstalledScriptInfo.xml"
|
||||
if (test-Path -Type Leaf -Path $xmlPath) {
|
||||
Remove-Item -Force -Path $xmlPath -ErrorAction Ignore
|
||||
}
|
||||
}
|
||||
|
||||
Describe "PowerShellGet - Script tests" -tags "Feature" {
|
||||
|
||||
Reference in New Issue
Block a user