mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-18 05:05:36 +00:00
This commit is contained in:
1 parent
648461a336
commit
d5e2ddb984
2 files changed
+33
-3
No files matched your search
@@ -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