From e00afd3f1f66a1755707b73cd6e7badfa468c78b Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 17:17:12 -0500 Subject: [PATCH 01/25] Rename PowerShellGet to PSResourceGet --- .github/workflows/ci.yml | 14 ++++----- .github/workflows/lint-powershell.yml | 5 +--- CHANGELOG.md | 14 ++++----- README.md | 26 ++++++++-------- SignSettings.psd1 | 2 +- ...Get.psd1 => AnyPackage.PSResourceGet.psd1} | 16 +++++----- ...Get.psm1 => AnyPackage.PSResourceGet.psm1} | 30 +++++++++---------- test/Find-Package.Tests.ps1 | 10 +++---- test/Get-Package.Tests.ps1 | 4 +-- test/Get-PackageSource.Tests.ps1 | 4 +-- test/Install-Package.Tests.ps1 | 18 +++++------ test/Publish-Package.Tests.ps1 | 6 ++-- test/Register-PackageSource.Tests.ps1 | 17 +++++------ test/Save-Package.Tests.ps1 | 16 +++++----- test/Set-PackageSource.Tests.ps1 | 6 ++-- test/Uninstall-Package.Tests.ps1 | 8 ++--- test/Unregister-PackageSource.Tests.ps1 | 2 +- test/Update-Package.Tests.ps1 | 16 +++++----- 18 files changed, 103 insertions(+), 111 deletions(-) rename src/{AnyPackage.PowerShellGet.psd1 => AnyPackage.PSResourceGet.psd1} (53%) rename src/{AnyPackage.PowerShellGet.psm1 => AnyPackage.PSResourceGet.psm1} (93%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4dc9ed8..d980fdd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,14 +40,14 @@ jobs: - name: Install AnyPackage run: Install-Module AnyPackage -Force -AllowClobber - - name: Install PowerShellGet - run: Install-Module PowerShellGet -AllowPrerelease -Force -AllowClobber + - name: Install PSResourceGet + run: Install-Module Microsoft.PowerShell.PSResourceGet -AllowPrerelease -Force -AllowClobber - name: Download module uses: actions/download-artifact@v3 with: name: module - path: AnyPackage.PowerShellGet + path: AnyPackage.PSResourceGet - name: Move module run: | @@ -57,7 +57,7 @@ jobs: $path = "$HOME/.local/share/powershell/Modules" } - Move-Item AnyPackage.PowerShellGet $path + Move-Item AnyPackage.PSResourceGet $path - name: Test with Pester run: | @@ -100,7 +100,7 @@ jobs: - name: Create and sign catalog file run: | $config = Import-PowerShellDataFile SignSettings.psd1 - $config['FilePath'] = 'AnyPackage.PowerShellGet.cat' + $config['FilePath'] = 'AnyPackage.PSResourceGet.cat' $config['Certificate'] = Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert Set-Location .\module New-FileCatalog $config['FilePath'] -CatalogVersion 2 @@ -122,7 +122,7 @@ jobs: uses: actions/download-artifact@v3 with: name: module-signed - path: '~/.local/share/powershell/Modules/AnyPackage.PowerShellGet' + path: '~/.local/share/powershell/Modules/AnyPackage.PSResourceGet' - name: Install AnyPackage run: Install-Module AnyPackage -Force -AllowClobber @@ -130,4 +130,4 @@ jobs: - name: Publish Module env: NUGET_KEY: ${{ secrets.NUGET_KEY }} - run: Publish-Module -Name AnyPackage.PowerShellGet -NuGetApiKey $env:NUGET_KEY + run: Publish-Module -Name AnyPackage.PSResourceGet -NuGetApiKey $env:NUGET_KEY diff --git a/.github/workflows/lint-powershell.yml b/.github/workflows/lint-powershell.yml index 7621bbc..2c1e354 100644 --- a/.github/workflows/lint-powershell.yml +++ b/.github/workflows/lint-powershell.yml @@ -32,12 +32,9 @@ jobs: - name: Install ConvertToSARIF run: Install-Module ConvertToSARIF -Force - - name: Install PowerShellGet - run: Install-Module PowerShellGet -Force -AllowClobber -AllowPrerelease - - name: Run PSScriptAnalyzer run: | - Import-Module AnyPackage, ConvertToSARIF, PowerShellGet -PassThru + Import-Module AnyPackage, ConvertToSARIF -PassThru Invoke-ScriptAnalyzer -Path . -Recurse | ConvertTo-SARIF -FilePath results.sarif - name: Upload SARIF results file diff --git a/CHANGELOG.md b/CHANGELOG.md index aab5a9f..3ae733b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,10 +50,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release -[Unreleased]: https://github.com/AnyPackage/anypackage/powershellget/compare/v0.2.4...HEAD -[0.2.4]: https://github.com/anypackage/powershellget/releases/tag/v0.2.4 -[0.2.3]: https://github.com/anypackage/powershellget/releases/tag/v0.2.3 -[0.2.2]: https://github.com/anypackage/powershellget/releases/tag/v0.2.2 -[0.2.1]: https://github.com/anypackage/powershellget/releases/tag/v0.2.1 -[0.2.0]: https://github.com/anypackage/powershellget/releases/tag/v0.2.0 -[0.1.0]: https://github.com/anypackage/powershellget/releases/tag/v0.1.0 +[Unreleased]: https://github.com/AnyPackage/anypackage/psresourceget/compare/v0.2.4...HEAD +[0.2.4]: https://github.com/anypackage/psresourceget/releases/tag/v0.2.4 +[0.2.3]: https://github.com/anypackage/psresourceget/releases/tag/v0.2.3 +[0.2.2]: https://github.com/anypackage/psresourceget/releases/tag/v0.2.2 +[0.2.1]: https://github.com/anypackage/psresourceget/releases/tag/v0.2.1 +[0.2.0]: https://github.com/anypackage/psresourceget/releases/tag/v0.2.0 +[0.1.0]: https://github.com/anypackage/psresourceget/releases/tag/v0.1.0 diff --git a/README.md b/README.md index 85f6646..db0f4b4 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,27 @@ -# AnyPackage.PowerShellGet +# AnyPackage.PSResourceGet -AnyPackage.PowerShellGet is an AnyPackage provider that facilitates installing PowerShellGet v3 resources from NuGet repositories. +AnyPackage.PSResourceGet is an AnyPackage provider that facilitates installing PSResourceGet resources from NuGet repositories. ## Documentation -AnyPackage.PowerShellGet documentation is located in [Provider Catalog](https://www.anypackage.dev/docs/provider-catalog/powershellget/about_PowerShellGet_Provider) on how to use the provider and what dynamic parameters exist. +AnyPackage.PSResourceGet documentation is located in [Provider Catalog](https://www.anypackage.dev/docs/provider-catalog/psresourceget/about_PSResourceGet_Provider) on how to use the provider and what dynamic parameters exist. -## Install AnyPackage.PowerShellGet +## Install AnyPackage.PSResourceGet -> NOTE! PowerShellGet v3 is required. -Due to a PowerShellGet issue, prerelease modules cannot be defined as dependencies, so manual installation of PowerShellGet v3 is required. +> NOTE! Microsoft.PowerShell.PSResourceGet is required. +Due to a PSResourceGet issue, prerelease modules cannot be defined as dependencies, so manual installation of PSResourceGet is required. ```PowerShell -# Install PowerShellGet v3 -Install-Module PowerShellGet -AllowPrerelease -AllowClobber -Force +# Install Microsoft.PowerShell.PSResourceGet +Install-Module Microsoft.PowerShell.PSResourceGet -AllowPrerelease -AllowClobber -Force -Install-Module AnyPackage.PowerShellGet +Install-Module AnyPackage.PSResourceGet ``` -## Import AnyPackage.PowerShellGet +## Import AnyPackage.PSResourceGet ```PowerShell -Import-Module AnyPackage.PowerShellGet +Import-Module AnyPackage.PSResourceGet ``` ## Sample usages @@ -81,7 +81,7 @@ Publish-Package -Path C:\Temp\module\module.psd1 ### Manage official package sources ```PowerShell -Register-PackageSource -Provider PowerShellGet -PSGallery +Register-PackageSource -Provider PSResourceGet -PSGallery Find-Package -Name Scoop | Install-Package Unregister-PackageSource -Name PSGallery ``` @@ -96,7 +96,7 @@ Unregister-PackageSource -Name Test ## Known Issues -### Missing PowerShellGet parameters +### Missing PSResourceGet parameters There are a few missing dynamic parameters: diff --git a/SignSettings.psd1 b/SignSettings.psd1 index ca0e546..a697f88 100644 --- a/SignSettings.psd1 +++ b/SignSettings.psd1 @@ -1,5 +1,5 @@ @{ - FilePath = @('AnyPackage.PowerShellGet.psd1', 'AnyPackage.PowerShellGet.psm1') + FilePath = @('AnyPackage.PSResourceGet.psd1', 'AnyPackage.PSResourceGet.psm1') TimeStampServer = 'http://timestamp.sectigo.com' HashAlgorithm = 'SHA256' } diff --git a/src/AnyPackage.PowerShellGet.psd1 b/src/AnyPackage.PSResourceGet.psd1 similarity index 53% rename from src/AnyPackage.PowerShellGet.psd1 rename to src/AnyPackage.PSResourceGet.psd1 index fd25463..41162bd 100644 --- a/src/AnyPackage.PowerShellGet.psd1 +++ b/src/AnyPackage.PSResourceGet.psd1 @@ -1,26 +1,26 @@ @{ - RootModule = 'AnyPackage.PowerShellGet.psm1' + RootModule = 'AnyPackage.PSResourceGet.psm1' ModuleVersion = '0.2.4' CompatiblePSEditions = @('Desktop', 'Core') - GUID = 'cc680200-a0c8-40df-a004-64c3899a72c9' + GUID = '4ffeffd3-7f83-4655-ac94-19eb41ebc792' Author = 'Thomas Nieto' Copyright = '(c) 2023 Thomas Nieto. All rights reserved.' - Description = 'PowerShellGet provider for AnyPackage.' + Description = 'PSResourceGet provider for AnyPackage.' PowerShellVersion = '5.1' RequiredModules = @( @{ ModuleName = 'AnyPackage'; ModuleVersion = '0.5.1' }, - 'PowerShellGet') + 'Microsoft.PowerShell.PSResourceGet') FunctionsToExport = @() CmdletsToExport = @() AliasesToExport = @() PrivateData = @{ AnyPackage = @{ - Providers = 'PowerShellGet' + Providers = 'PSResourceGet' } PSData = @{ - Tags = @('AnyPackage', 'Provider', 'PowerShellGet', 'Windows', 'Linux', 'MacOS') - LicenseUri = 'https://github.com/anypackage/powershellget/blob/main/LICENSE' - ProjectUri = 'https://github.com/anypackage/powershellget' + Tags = @('AnyPackage', 'Provider', 'PSResourceGet', 'Windows', 'Linux', 'MacOS') + LicenseUri = 'https://github.com/anypackage/psresourceget/blob/main/LICENSE' + ProjectUri = 'https://github.com/anypackage/psresourceget' } } HelpInfoUri = 'https://go.anypackage.dev/help' diff --git a/src/AnyPackage.PowerShellGet.psm1 b/src/AnyPackage.PSResourceGet.psm1 similarity index 93% rename from src/AnyPackage.PowerShellGet.psm1 rename to src/AnyPackage.PSResourceGet.psm1 index 7ba465c..6fbeb1a 100644 --- a/src/AnyPackage.PowerShellGet.psm1 +++ b/src/AnyPackage.PSResourceGet.psm1 @@ -3,14 +3,14 @@ # terms of the MIT license. using module AnyPackage -using module PowerShellGet +using module Microsoft.PowerShell.PSResourceGet using namespace System.Collections.Generic using namespace AnyPackage.Provider -using namespace Microsoft.PowerShell.PowerShellGet.UtilClasses +using namespace Microsoft.PowerShell.PSResourceGet.UtilClasses -[PackageProvider('PowerShellGet')] -class PowerShellGetProvider : PackageProvider, IGetPackage, IFindPackage, +[PackageProvider('PSResourceGet')] +class PSResourceGetProvider : PackageProvider, IGetPackage, IFindPackage, IInstallPackage, ISavePackage, IUninstallPackage, IUpdatePackage, IPublishPackage, IGetSource, ISetSource { #region GetPackage @@ -134,10 +134,10 @@ IUpdatePackage, IPublishPackage, IGetSource, ISetSource { ConvertTo-Hashtable -Hashtable $uninstallParams -IsBound # Issue to get PassThru parameter added - # https://github.com/PowerShell/PowerShellGet/issues/667 + # https://github.com/PowerShell/PSResourceGet/issues/667 # Prerelease parameter causes it to silently fail - # https://github.com/PowerShell/PowerShellGet/issues/842 + # https://github.com/PowerShell/PSResourceGet/issues/842 Get-PSResource @params | ForEach-Object { try { @@ -171,7 +171,7 @@ IUpdatePackage, IPublishPackage, IGetSource, ISetSource { ConvertTo-Hashtable -Hashtable $updateParams -IsBound # Find-PSResource pipeline input - # https://github.com/PowerShell/PowerShellGet/issues/666 + # https://github.com/PowerShell/PSResourceGet/issues/666 Get-PSResource -Name $request.Name -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name -Unique | Find-PSResource @params -ErrorAction SilentlyContinue | @@ -196,7 +196,7 @@ IUpdatePackage, IPublishPackage, IGetSource, ISetSource { try { # PassThru parameter - # https://github.com/PowerShell/PowerShellGet/issues/718 + # https://github.com/PowerShell/PSResourceGet/issues/718 Publish-PSResource @params -ErrorAction Stop $params.Remove('Path') @@ -359,19 +359,19 @@ class InstallPackageDynamicParameters : InstallUpdateDynamicParameters { [switch] $Reinstall # Install-PSResource -NoClobber fails - # https://github.com/PowerShell/PowerShellGet/issues/946 + # https://github.com/PowerShell/PSResourceGet/issues/946 # [Parameter()] # [switch] $NoClobber } class SavePackageDynamicParameters : InstallDynamicParameters { # Pipeline input fails with -AsNupkg - # https://github.com/PowerShell/PowerShellGet/issues/948 + # https://github.com/PowerShell/PSResourceGet/issues/948 # [Parameter()] # [switch] $AsNupkg # Pipeline input fails with -IncludeXml - # https://github.com/PowerShell/PowerShellGet/issues/949 + # https://github.com/PowerShell/PSResourceGet/issues/949 # [Parameter()] # [switch] $IncludeXml } @@ -403,7 +403,7 @@ class RegisterPackageSourceDynamicParameters : SetPackageSourceDynamicParameters } [guid] $id = 'c9a39544-274b-4935-9cad-7423e8c47e6b' -[PackageProviderManager]::RegisterProvider($id, [PowerShellGetProvider], $MyInvocation.MyCommand.ScriptBlock.Module) +[PackageProviderManager]::RegisterProvider($id, [PSResourceGetProvider], $MyInvocation.MyCommand.ScriptBlock.Module) $MyInvocation.MyCommand.ScriptBlock.Module.OnRemove = { [PackageProviderManager]::UnregisterProvider($id) @@ -476,7 +476,7 @@ function Get-Latest { $resources | Group-Object -Property Name | ForEach-Object { - # PowerShellGet returns the latest as the first object + # PSResourceGet returns the latest as the first object $_.Group | Select-Object -First 1 } } @@ -520,7 +520,7 @@ function Write-Package { ) begin { - $sources = Get-PackageSource -Provider AnyPackage.PowerShellGet\PowerShellGet + $sources = Get-PackageSource -Provider AnyPackage.PSResourceGet\PSResourceGet } process { @@ -537,7 +537,7 @@ function Write-Package { Where-Object Name -eq $resource.Repository # Blank RepositorySourceLocation - # https://github.com/PowerShell/PowerShellGet/issues/1052 + # https://github.com/PowerShell/PSResourceGet/issues/1052 if (-not $source -and $resource.RepositorySourceLocation) { $source = [PackageSourceInfo]::new($resource.Repository, $resource.RepositorySourceLocation, $false, $Request.ProviderInfo) } diff --git a/test/Find-Package.Tests.ps1 b/test/Find-Package.Tests.ps1 index 099e43d..10c4ef7 100644 --- a/test/Find-Package.Tests.ps1 +++ b/test/Find-Package.Tests.ps1 @@ -1,8 +1,8 @@ -#requires -modules AnyPackage.PowerShellGet +#requires -modules AnyPackage.PSResourceGet Describe Find-Package { Context 'with -Name parameter' { - It 'should return results for <_>' -TestCases 'PSReadline', @('PSReadline', 'PowerShellGet'), 'AnyPackage*' { + It 'should return results for <_>' -TestCases 'PSReadLine', @('PSReadLine', 'Microsoft.PowerShell.Archive'), 'AnyPackage*' { $resources = Find-PSResource -Name $_ $results = Find-Package -Name $_ @@ -64,7 +64,7 @@ Describe Find-Package { Context 'with -Prerelease parameter' { It 'should return prerelease versions' { - Find-Package -Name PowerShellGet -Version * -Prerelease | + Find-Package -Name Microsoft.PowerShell.Archive -Version * -Prerelease | Where-Object { $_.Version.IsPrerelease } | Should -Not -BeNullOrEmpty } @@ -72,9 +72,9 @@ Describe Find-Package { Context 'with -Latest parameter' { It 'should return latest version for <_> version range' -TestCases '[1.0,2.0]' { - $resource = Find-PSResource -Name PowerShellGet -Version $_ | + $resource = Find-PSResource -Name Microsoft.PowerShell.Archive -Version $_ | Select-Object -First 1 - $package = Find-Package -Name PowerShellGet -Version $_ -Provider PowerShellGet -Latest + $package = Find-Package -Name Microsoft.PowerShell.Archive -Version $_ -Provider PSResourceGet -Latest $package.Version.ToString() | Should -Be $resource.Version.ToString() } diff --git a/test/Get-Package.Tests.ps1 b/test/Get-Package.Tests.ps1 index b57df89..5ef485f 100644 --- a/test/Get-Package.Tests.ps1 +++ b/test/Get-Package.Tests.ps1 @@ -1,6 +1,4 @@ -#requires -modules AnyPackage.PowerShellGet - -using namespace NuGet.Versioning +#requires -modules AnyPackage.PSResourceGet Describe Get-Package { BeforeAll { diff --git a/test/Get-PackageSource.Tests.ps1 b/test/Get-PackageSource.Tests.ps1 index a1a81b5..d37b746 100644 --- a/test/Get-PackageSource.Tests.ps1 +++ b/test/Get-PackageSource.Tests.ps1 @@ -1,4 +1,4 @@ -#requires -modules AnyPackage.PowerShellGet +#requires -modules AnyPackage.PSResourceGet Describe Get-PackageSource { BeforeAll { @@ -11,7 +11,7 @@ Describe Get-PackageSource { Unregister-PSResourceRepository -Name Test } - Context 'with no additonal parameters' { + Context 'with no additional parameters' { It 'should return results' { Get-PackageSource | Should -Not -BeNullOrEmpty diff --git a/test/Install-Package.Tests.ps1 b/test/Install-Package.Tests.ps1 index 866c69c..73b99ac 100644 --- a/test/Install-Package.Tests.ps1 +++ b/test/Install-Package.Tests.ps1 @@ -1,4 +1,4 @@ -#requires -modules AnyPackage.PowerShellGet +#requires -modules AnyPackage.PSResourceGet Describe Install-Package { AfterEach { @@ -58,7 +58,7 @@ Describe Install-Package { Context 'with -Scope parameter' { It 'should install <_> successfully' -TestCases 'SNMP' { - Install-Package -Name $_ -Provider PowerShellGet -Scope CurrentUser -PassThru | + Install-Package -Name $_ -Provider PSResourceGet -Scope CurrentUser -PassThru | Should -Not -BeNullOrEmpty } } @@ -79,7 +79,7 @@ Describe Install-Package { Context 'with -AuthenticodeCheck parameter' { It 'should install <_> successfully' -TestCases 'Microsoft.PowerShell.Archive' { - Install-Package -Name $_ -Provider PowerShellGet -AuthenticodeCheck -PassThru | + Install-Package -Name $_ -Provider PSResourceGet -AuthenticodeCheck -PassThru | Should -Not -BeNullOrEmpty } } @@ -92,7 +92,7 @@ Describe Install-Package { Context 'with -SkipDependencyCheck parameter' { It 'should install <_> successfully' -TestCases 'SNMP' { - Install-Package -Name $_ -Provider PowerShellGet -SkipDependencyCheck -PassThru | + Install-Package -Name $_ -Provider PSResourceGet -SkipDependencyCheck -PassThru | Should -Not -BeNullOrEmpty } } @@ -100,30 +100,30 @@ Describe Install-Package { Context 'with -TemporaryPath parameter' { It 'should install <_> successfully' -TestCases 'SNMP' { $path = Get-PSDrive TestDrive | Select-Object -ExpandProperty Root - Install-Package -Name $_ -Provider PowerShellGet -TemporaryPath $path -PassThru | + Install-Package -Name $_ -Provider PSResourceGet -TemporaryPath $path -PassThru | Should -Not -BeNullOrEmpty } } Context 'with -NoClobber parameter' { # Install-PSResource -NoClobber fails - # https://github.com/PowerShell/PowerShellGet/issues/946 + # https://github.com/PowerShell/PSResourceGet/issues/946 It 'should install <_> successfully' -TestCases 'SNMP' -Skip { - Install-Package -Name $_ -Provider PowerShellGet -NoClobber -PassThru | + Install-Package -Name $_ -Provider PSResourceGet -NoClobber -PassThru | Should -Not -BeNullOrEmpty } } Context 'with -AcceptLicense parameter' { It 'should install <_> successfully' -TestCases 'SNMP' { - Install-Package -Name $_ -Provider PowerShellGet -AcceptLicense -PassThru | + Install-Package -Name $_ -Provider PSResourceGet -AcceptLicense -PassThru | Should -Not -BeNullOrEmpty } } Context 'with -Reinstall parameter' { It 'should install <_> successfully' -TestCases 'SNMP' { - Install-Package -Name $_ -Provider PowerShellGet -Reinstall -PassThru | + Install-Package -Name $_ -Provider PSResourceGet -Reinstall -PassThru | Should -Not -BeNullOrEmpty } } diff --git a/test/Publish-Package.Tests.ps1 b/test/Publish-Package.Tests.ps1 index 4786047..4764374 100644 --- a/test/Publish-Package.Tests.ps1 +++ b/test/Publish-Package.Tests.ps1 @@ -1,4 +1,4 @@ -#requires -modules AnyPackage.PowerShellGet +#requires -modules AnyPackage.PSResourceGet Describe Publish-Package { BeforeAll { @@ -13,7 +13,7 @@ Describe Publish-Package { Context 'with -Path parameter' { It 'should publish <_> to local repository' -TestCases 'SNMP' { - # https://github.com/PowerShell/PowerShellGet/issues/940 + # https://github.com/PowerShell/PSResourceGet/issues/940 $testRoot = Get-PSDrive -Name TestDrive | Select-Object -ExpandProperty Root Save-PSResource -Name $_ -Path $testRoot -TrustRepository @@ -26,7 +26,7 @@ Describe Publish-Package { Context 'with -DestinationPath parameter' { It 'should publish and create nupkg' -TestCases 'SNMP' { - # https://github.com/PowerShell/PowerShellGet/issues/940 + # https://github.com/PowerShell/PSResourceGet/issues/940 $testRoot = Get-PSDrive -Name TestDrive | Select-Object -ExpandProperty Root Save-PSResource -Name $_ -Path $testRoot -TrustRepository diff --git a/test/Register-PackageSource.Tests.ps1 b/test/Register-PackageSource.Tests.ps1 index cfed39d..0123a08 100644 --- a/test/Register-PackageSource.Tests.ps1 +++ b/test/Register-PackageSource.Tests.ps1 @@ -1,7 +1,4 @@ -#requires -modules AnyPackage.PowerShellGet - -using module PowerShellGet -using namespace Microsoft.PowerShell.PowerShellGet.UtilClasses +#requires -modules AnyPackage.PSResourceGet Describe Register-Package { AfterEach { @@ -24,7 +21,7 @@ Describe Register-Package { $registerPackageSourceParams = @{ Name = 'Test' Location = $path - Provider = 'PowerShellGet' + Provider = 'PSResourceGet' PassThru = $true } @@ -41,7 +38,7 @@ Describe Register-Package { $registerPackageSourceParams = @{ Name = 'Test' Location = $path - Provider = 'PowerShellGet' + Provider = 'PSResourceGet' Trusted = $true PassThru = $true } @@ -58,7 +55,7 @@ Describe Register-Package { $registerPackageSourceParams = @{ Name = 'Test' Location = $path - Provider = 'PowerShellGet' + Provider = 'PSResourceGet' Trusted = $false PassThru = $true } @@ -77,7 +74,7 @@ Describe Register-Package { $registerPackageSourceParams = @{ Name = 'Test' Location = $path - Provider = 'PowerShellGet' + Provider = 'PSResourceGet' PassThru = $true Priority = $_ } @@ -104,7 +101,7 @@ Describe Register-Package { It 'should register' { $registerPackageSourceParams = @{ - Provider = 'PowerShellGet' + Provider = 'PSResourceGet' PassThru = $true PSGallery = $true } @@ -121,7 +118,7 @@ Describe Register-Package { $registerPackageSourceParams = @{ Name = 'Test' Location = $path - Provider = 'PowerShellGet' + Provider = 'PSResourceGet' PassThru = $true CredentialInfo = $_ } diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index 4f7b804..aa8de3c 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -1,4 +1,4 @@ -#requires -modules AnyPackage.PowerShellGet +#requires -modules AnyPackage.PSResourceGet Describe Save-Package { AfterEach { @@ -86,14 +86,14 @@ Describe Save-Package { Context 'with -AsNupkg parameter' { # Pipeline input fails with -AsNupkg - # https://github.com/PowerShell/PowerShellGet/issues/948 + # https://github.com/PowerShell/PSResourceGet/issues/948 It 'should save <_> successfully' -TestCases 'AnyPackge' -Skip { $savePackageParams = @{ Name = $_ Path = (Get-PSDrive -Name TestDrive | Select-Object -ExpandProperty Root) PassThru = $true AsNupkg = $true - Provider = 'PowerShellGet' + Provider = 'PSResourceGet' } Save-Package @savePackageParams | @@ -103,14 +103,14 @@ Describe Save-Package { Context 'with -IncludeXml parameter' { # Pipeline input fails with -IncludeXml - # https://github.com/PowerShell/PowerShellGet/issues/949 + # https://github.com/PowerShell/PSResourceGet/issues/949 It 'should save <_> successfully' -TestCases 'AnyPackge' -Skip { $savePackageParams = @{ Name = $_ Path = (Get-PSDrive -Name TestDrive | Select-Object -ExpandProperty Root) PassThru = $true IncludeXml = $true - Provider = 'PowerShellGet' + Provider = 'PSResourceGet' } Save-Package @savePackageParams | @@ -124,7 +124,7 @@ Describe Save-Package { Name = $_ Path = (Get-PSDrive -Name TestDrive | Select-Object -ExpandProperty Root) PassThru = $true - Provider = 'PowerShellGet' + Provider = 'PSResourceGet' AuthenticodeCheck = $true } @@ -144,7 +144,7 @@ Describe Save-Package { Path = (Get-PSDrive -Name TestDrive | Select-Object -ExpandProperty Root) PassThru = $true SkipDependencyCheck = $true - Provider = 'PowerShellGet' + Provider = 'PSResourceGet' } Save-Package @savePackageParams | @@ -161,7 +161,7 @@ Describe Save-Package { Name = $_ Path = $path PassThru = $true - Provider = 'PowerShellGet' + Provider = 'PSResourceGet' TemporaryPath = "$path/temp" } diff --git a/test/Set-PackageSource.Tests.ps1 b/test/Set-PackageSource.Tests.ps1 index f718447..87bfa48 100644 --- a/test/Set-PackageSource.Tests.ps1 +++ b/test/Set-PackageSource.Tests.ps1 @@ -1,4 +1,4 @@ -#requires -modules AnyPackage.PowerShellGet +#requires -modules AnyPackage.PSResourceGet Describe Set-PackageSource { BeforeAll { @@ -33,7 +33,7 @@ Describe Set-PackageSource { It 'should have priority <_>' -TestCases 10 { $registerPackageSourceParams = @{ Name = 'Test' - Provider = 'PowerShellGet' + Provider = 'PSResourceGet' PassThru = $true Priority = $_ } @@ -49,7 +49,7 @@ Describe Set-PackageSource { $registerPackageSourceParams = @{ Name = 'Test' - Provider = 'PowerShellGet' + Provider = 'PSResourceGet' PassThru = $true CredentialInfo = $_ } diff --git a/test/Uninstall-Package.Tests.ps1 b/test/Uninstall-Package.Tests.ps1 index bb55487..f6dc08a 100644 --- a/test/Uninstall-Package.Tests.ps1 +++ b/test/Uninstall-Package.Tests.ps1 @@ -1,4 +1,4 @@ -#requires -modules AnyPackage.PowerShellGet +#requires -modules AnyPackage.PSResourceGet Describe Uninstall-Package { BeforeEach { @@ -41,21 +41,21 @@ Describe Uninstall-Package { Context 'with -Scope parameter' { It 'should uninstall <_> successfully' -TestCases 'SNMP' { - Uninstall-Package -Name $_ -Provider PowerShellGet -Scope CurrentUser -PassThru | + Uninstall-Package -Name $_ -Provider PSResourceGet -Scope CurrentUser -PassThru | Should -Not -BeNullOrEmpty } } Context 'with -SkipDependencyCheck' { It 'should uninstall <_> successfully' -TestCases 'SNMP' { - Uninstall-Package -Name $_ -Provider PowerShellGet -SkipDependencyCheck -PassThru | + Uninstall-Package -Name $_ -Provider PSResourceGet -SkipDependencyCheck -PassThru | Should -Not -BeNullOrEmpty } } Context 'with -Scope' { It 'should uninstall <_> successfully' -TestCases 'SNMP' { - Uninstall-Package -Name $_ -Provider PowerShellGet -Scope CurrentUser -PassThru | + Uninstall-Package -Name $_ -Provider PSResourceGet -Scope CurrentUser -PassThru | Should -Not -BeNullOrEmpty } } diff --git a/test/Unregister-PackageSource.Tests.ps1 b/test/Unregister-PackageSource.Tests.ps1 index 17e3e15..606de86 100644 --- a/test/Unregister-PackageSource.Tests.ps1 +++ b/test/Unregister-PackageSource.Tests.ps1 @@ -1,4 +1,4 @@ -#requires -modules AnyPackage.PowerShellGet +#requires -modules AnyPackage.PSResourceGet Describe Unregister-PackageSource { BeforeEach { diff --git a/test/Update-Package.Tests.ps1 b/test/Update-Package.Tests.ps1 index 78e4bd9..e76f6bd 100644 --- a/test/Update-Package.Tests.ps1 +++ b/test/Update-Package.Tests.ps1 @@ -1,4 +1,4 @@ -#requires -modules AnyPackage.PowerShellGet +#requires -modules AnyPackage.PSResourceGet Describe Update-Package { BeforeEach { @@ -42,7 +42,7 @@ Describe Update-Package { '[0.1.0]', '[0.2.0,]', '(0.1.0,)', - #'(,0.3.0)', https://github.com/PowerShell/PowerShellGet/issues/943 + #'(,0.3.0)', https://github.com/PowerShell/PSResourceGet/issues/943 '(0.2.0,0.3.0]', '(0.2.0,0.3.0)', '[0.2.0,0.3.0)' { @@ -79,7 +79,7 @@ Describe Update-Package { Uninstall-PSResource -Name Microsoft.PowerShell.Archive } - It 'should update <_> sucessfully' -TestCases 'Microsoft.PowerShell.Archive' { + It 'should update <_> successfully' -TestCases 'Microsoft.PowerShell.Archive' { $package = Update-Package -Name $_ -Version '[2.0,2.0.1)' -Prerelease -PassThru $package.Version.IsPrerelease | Should -BeTrue @@ -88,7 +88,7 @@ Describe Update-Package { Context 'with -AcceptLicense parameter' { It 'should update <_> successfully' -TestCases 'SNMP' { - Update-Package -Name $_ -Provider PowerShellGet -AcceptLicense -PassThru | + Update-Package -Name $_ -Provider PSResourceGet -AcceptLicense -PassThru | Should -Not -BeNullOrEmpty } } @@ -99,24 +99,24 @@ Describe Update-Package { } } - Context 'with -TemporaryPath paramter' { + Context 'with -TemporaryPath parameter' { It 'should update <_> successfully' -TestCases 'SNMP' { $path = Get-PSDrive TestDrive | Select-Object -ExpandProperty Root - Update-Package -Name $_ -Provider PowerShellGet -TemporaryPath $path -PassThru | + Update-Package -Name $_ -Provider PSResourceGet -TemporaryPath $path -PassThru | Should -Not -BeNullOrEmpty } } Context 'with -Scope parameter' { It 'should update <_> successfully' -TestCases 'SNMP' { - Update-Package -Name $_ -Provider PowerShellGet -Scope CurrentUser -PassThru | + Update-Package -Name $_ -Provider PSResourceGet -Scope CurrentUser -PassThru | Should -Not -BeNullOrEmpty } } Context 'with -SkipDependencyCheck' { It 'should update <_> successfully' -TestCases 'SNMP' { - Update-Package -Name $_ -Provider PowerShellGet -SkipDependencyCheck -PassThru | + Update-Package -Name $_ -Provider PSResourceGet -SkipDependencyCheck -PassThru | Should -Not -BeNullOrEmpty } } From f804fb9b1fc5dfc42437846b59e5f859fe2daee6 Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 17:20:32 -0500 Subject: [PATCH 02/25] Fix missing psresourceget code scanning --- .github/workflows/lint-powershell.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-powershell.yml b/.github/workflows/lint-powershell.yml index 2c1e354..a5fb934 100644 --- a/.github/workflows/lint-powershell.yml +++ b/.github/workflows/lint-powershell.yml @@ -32,9 +32,12 @@ jobs: - name: Install ConvertToSARIF run: Install-Module ConvertToSARIF -Force + - name: Install Microsoft.PowerShell.PSResourceGet + run: Install-Module Microsoft.PowerShell.PSResourceGet -Force -AllowClobber -AllowPrerelease + - name: Run PSScriptAnalyzer run: | - Import-Module AnyPackage, ConvertToSARIF -PassThru + Import-Module AnyPackage, ConvertToSARIF, Microsoft.PowerShell.PSResourceGet -PassThru Invoke-ScriptAnalyzer -Path . -Recurse | ConvertTo-SARIF -FilePath results.sarif - name: Upload SARIF results file From 1e7a3237e69707bdbae6037bd13ae790b928c321 Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 17:23:06 -0500 Subject: [PATCH 03/25] Fix Get-PSResource to Get-InstalledPSResource --- src/AnyPackage.PSResourceGet.psm1 | 6 +++--- test/Get-Package.Tests.ps1 | 6 +++--- test/Install-Package.Tests.ps1 | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/AnyPackage.PSResourceGet.psm1 b/src/AnyPackage.PSResourceGet.psm1 index 6fbeb1a..07c94ea 100644 --- a/src/AnyPackage.PSResourceGet.psm1 +++ b/src/AnyPackage.PSResourceGet.psm1 @@ -27,7 +27,7 @@ IUpdatePackage, IPublishPackage, IGetSource, ISetSource { $request.DynamicParameters | ConvertTo-Hashtable -Hashtable $params -IsBound - Get-PSResource @params | + Get-InstalledPSResource @params | Write-Package -Request $request } #endregion @@ -138,7 +138,7 @@ IUpdatePackage, IPublishPackage, IGetSource, ISetSource { # Prerelease parameter causes it to silently fail # https://github.com/PowerShell/PSResourceGet/issues/842 - Get-PSResource @params | + Get-InstalledPSResource @params | ForEach-Object { try { $_ | Uninstall-PSResource @uninstallParams -ErrorAction Stop @@ -172,7 +172,7 @@ IUpdatePackage, IPublishPackage, IGetSource, ISetSource { # Find-PSResource pipeline input # https://github.com/PowerShell/PSResourceGet/issues/666 - Get-PSResource -Name $request.Name -ErrorAction SilentlyContinue | + Get-InstalledPSResource -Name $request.Name -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name -Unique | Find-PSResource @params -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name -Unique | diff --git a/test/Get-Package.Tests.ps1 b/test/Get-Package.Tests.ps1 index 5ef485f..84ca8bd 100644 --- a/test/Get-Package.Tests.ps1 +++ b/test/Get-Package.Tests.ps1 @@ -19,7 +19,7 @@ Describe Get-Package { Context 'with -Name parameter' { It 'should return results for <_>' -TestCases 'SNMP', @('PSWindowsUpdate', 'DellBIOSProvider'), '*win*' { - $resources = Get-PSResource -Name $_ + $resources = Get-InstalledPSResource -Name $_ $results = Get-Package -Name $_ $results | Should -Not -BeNullOrEmpty @@ -32,7 +32,7 @@ Describe Get-Package { } It 'should have correct properties for <_>' -TestCases 'SNMP' { - $resource = Get-PSResource -Name $_ + $resource = Get-InstalledPSResource -Name $_ $package = Get-Package -Name $_ if ($resource.Prerelease) { @@ -65,7 +65,7 @@ Describe Get-Package { '(0.2.0,0.3.0]', '(0.2.0,0.3.0)', '[0.2.0,0.3.0)' { - $resources = Get-PSResource -Name Cobalt -Version $_ + $resources = Get-InstalledPSResource -Name Cobalt -Version $_ Get-Package -Name Cobalt -Version $_ | Should -HaveCount $resources.Count diff --git a/test/Install-Package.Tests.ps1 b/test/Install-Package.Tests.ps1 index 73b99ac..9a2a0f3 100644 --- a/test/Install-Package.Tests.ps1 +++ b/test/Install-Package.Tests.ps1 @@ -65,7 +65,7 @@ Describe Install-Package { Context 'with -Prerelease parameter' { AfterAll { - Get-PSResource -Name Microsoft.PowerShell.Archive -Version '(1.9,2.0.1)' | + Get-InstalledPSResource -Name Microsoft.PowerShell.Archive -Version '(1.9,2.0.1)' | Where-Object IsPrerelease | Uninstall-PSResource } From f886cd292ab21619806171e4a6a27ee1575618ce Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 17:35:29 -0500 Subject: [PATCH 04/25] Fix Microsoft.PowerShell.Archive prerelease --- test/Find-Package.Tests.ps1 | 8 ++++---- test/Install-Package.Tests.ps1 | 6 +++--- test/Update-Package.Tests.ps1 | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/Find-Package.Tests.ps1 b/test/Find-Package.Tests.ps1 index 10c4ef7..88fe899 100644 --- a/test/Find-Package.Tests.ps1 +++ b/test/Find-Package.Tests.ps1 @@ -64,17 +64,17 @@ Describe Find-Package { Context 'with -Prerelease parameter' { It 'should return prerelease versions' { - Find-Package -Name Microsoft.PowerShell.Archive -Version * -Prerelease | + Find-Package -Name PSReadLine -Version * -Prerelease | Where-Object { $_.Version.IsPrerelease } | Should -Not -BeNullOrEmpty } } Context 'with -Latest parameter' { - It 'should return latest version for <_> version range' -TestCases '[1.0,2.0]' { - $resource = Find-PSResource -Name Microsoft.PowerShell.Archive -Version $_ | + It 'should return latest version for <_> version range' -TestCases '[2.0,2.2]' { + $resource = Find-PSResource -Name PSReadLine -Version $_ | Select-Object -First 1 - $package = Find-Package -Name Microsoft.PowerShell.Archive -Version $_ -Provider PSResourceGet -Latest + $package = Find-Package -Name PSReadLine -Version $_ -Provider PSResourceGet -Latest $package.Version.ToString() | Should -Be $resource.Version.ToString() } diff --git a/test/Install-Package.Tests.ps1 b/test/Install-Package.Tests.ps1 index 9a2a0f3..caa7ec3 100644 --- a/test/Install-Package.Tests.ps1 +++ b/test/Install-Package.Tests.ps1 @@ -65,13 +65,13 @@ Describe Install-Package { Context 'with -Prerelease parameter' { AfterAll { - Get-InstalledPSResource -Name Microsoft.PowerShell.Archive -Version '(1.9,2.0.1)' | + Get-InstalledPSResource -Name PSReadLine -Version '(2.0,2.1)' | Where-Object IsPrerelease | Uninstall-PSResource } - It 'should install <_> sucessfully' -TestCases 'Microsoft.PowerShell.Archive' { - $package = Install-Package -Name $_ -Version '[2.0,2.0.1)' -Prerelease -PassThru + It 'should install <_> sucessfully' -TestCases 'PSReadLine' { + $package = Install-Package -Name $_ -Version '(2.0,2.1)' -Prerelease -PassThru $package.Version.IsPrerelease | Should -BeTrue } diff --git a/test/Update-Package.Tests.ps1 b/test/Update-Package.Tests.ps1 index e76f6bd..7ece641 100644 --- a/test/Update-Package.Tests.ps1 +++ b/test/Update-Package.Tests.ps1 @@ -72,15 +72,15 @@ Describe Update-Package { Context 'with -Prerelease parameter' { BeforeAll { - Install-PSResource -Name Microsoft.PowerShell.Archive -Version 1.0.1 -TrustRepository + Install-PSResource -Name PSReadLine -Version 1.0.1 -TrustRepository } AfterAll { - Uninstall-PSResource -Name Microsoft.PowerShell.Archive + Uninstall-PSResource -Name PSReadLine } - It 'should update <_> successfully' -TestCases 'Microsoft.PowerShell.Archive' { - $package = Update-Package -Name $_ -Version '[2.0,2.0.1)' -Prerelease -PassThru + It 'should update <_> successfully' -TestCases 'PSReadLine' { + $package = Update-Package -Name $_ -Version '(2.0,2.1)' -Prerelease -PassThru $package.Version.IsPrerelease | Should -BeTrue } From 095b24d0284cb4a9306335c604a63746bba94ca9 Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 17:51:05 -0500 Subject: [PATCH 05/25] Pin prerelease versions --- test/Install-Package.Tests.ps1 | 6 +++--- test/Save-Package.Tests.ps1 | 4 ++-- test/Update-Package.Tests.ps1 | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/Install-Package.Tests.ps1 b/test/Install-Package.Tests.ps1 index caa7ec3..eaa9851 100644 --- a/test/Install-Package.Tests.ps1 +++ b/test/Install-Package.Tests.ps1 @@ -65,13 +65,13 @@ Describe Install-Package { Context 'with -Prerelease parameter' { AfterAll { - Get-InstalledPSResource -Name PSReadLine -Version '(2.0,2.1)' | + Get-InstalledPSResource -Name PSReadLine -Version '2.0.0-rc2' | Where-Object IsPrerelease | Uninstall-PSResource } - It 'should install <_> sucessfully' -TestCases 'PSReadLine' { - $package = Install-Package -Name $_ -Version '(2.0,2.1)' -Prerelease -PassThru + It 'should install <_> successfully' -TestCases 'PSReadLine' { + $package = Install-Package -Name $_ -Version '2.0.0-rc2' -Prerelease -PassThru $package.Version.IsPrerelease | Should -BeTrue } diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index aa8de3c..e854cb8 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -38,8 +38,8 @@ Describe Save-Package { Context 'with -Prerelease parameter' { It 'should save' { $savePackageParams = @{ - Name = 'Microsoft.PowerShell.Archive' - Version = '[2.0.0,2.0.1)' + Name = 'PSReadLine' + Version = '2.0.0-rc2' Prerelease = $true Path = (Get-PSDrive -Name TestDrive | Select-Object -ExpandProperty Root) PassThru = $true diff --git a/test/Update-Package.Tests.ps1 b/test/Update-Package.Tests.ps1 index 7ece641..6fb8e26 100644 --- a/test/Update-Package.Tests.ps1 +++ b/test/Update-Package.Tests.ps1 @@ -72,7 +72,7 @@ Describe Update-Package { Context 'with -Prerelease parameter' { BeforeAll { - Install-PSResource -Name PSReadLine -Version 1.0.1 -TrustRepository + Install-PSResource -Name PSReadLine -Version 1.2 -TrustRepository } AfterAll { @@ -80,7 +80,7 @@ Describe Update-Package { } It 'should update <_> successfully' -TestCases 'PSReadLine' { - $package = Update-Package -Name $_ -Version '(2.0,2.1)' -Prerelease -PassThru + $package = Update-Package -Name $_ -Version '2.0.0-rc2' -Prerelease -PassThru $package.Version.IsPrerelease | Should -BeTrue } From 95c43cd311e6a5ea227977dabebf8a648336db0d Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 18:06:42 -0500 Subject: [PATCH 06/25] Remove try/catch --- test/Save-Package.Tests.ps1 | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index e854cb8..4486620 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -55,14 +55,8 @@ Describe Save-Package { BeforeEach { $path = Get-PSDrive TestDrive | Select-Object -ExpandProperty Root New-Item -Path $path/repo -ItemType Directory + Register-PSResourceRepository -Name Test -Uri $path/repo -Trusted Save-PSResource -Name AnyPackage, SNMP -Path $path/repo -TrustRepository -AsNupkg - - try { - Register-PSResourceRepository -Name Test -Uri $path/repo -Trusted - } - catch { - Write-Verbose -Message 'Test source already exists.' - } } AfterAll { From f02be5d2a41f12925f0f4631e9f1f5ef5ba08e84 Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 18:12:48 -0500 Subject: [PATCH 07/25] Test --- test/Register-PackageSource.Tests.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/Register-PackageSource.Tests.ps1 b/test/Register-PackageSource.Tests.ps1 index 0123a08..84ad567 100644 --- a/test/Register-PackageSource.Tests.ps1 +++ b/test/Register-PackageSource.Tests.ps1 @@ -1,6 +1,6 @@ #requires -modules AnyPackage.PSResourceGet -Describe Register-Package { +Describe Register-PackageSource { AfterEach { try { Register-PSResourceRepository -PSGallery @@ -11,7 +11,8 @@ Describe Register-Package { } AfterEach { - Unregister-PSResourceRepository -Name Test -ErrorAction Ignore + Get-PSResourceRepository -Name Test | + Unregister-PSResourceRepository } Context 'with -Uri parameter' { From 27313ed93f8086355976cda7f0f0581caac2bdda Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 18:18:14 -0500 Subject: [PATCH 08/25] Test --- test/Register-PackageSource.Tests.ps1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/Register-PackageSource.Tests.ps1 b/test/Register-PackageSource.Tests.ps1 index 84ad567..e82d7dd 100644 --- a/test/Register-PackageSource.Tests.ps1 +++ b/test/Register-PackageSource.Tests.ps1 @@ -8,10 +8,8 @@ Describe Register-PackageSource { catch { Write-Verbose -Message 'PSGallery already exists.' } - } - AfterEach { - Get-PSResourceRepository -Name Test | + Get-PSResourceRepository -Name Test -ErrorAction Ignore | Unregister-PSResourceRepository } From 8ed2039bf76f59c44d1f2c0aaaa20eb0540aa360 Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 18:23:09 -0500 Subject: [PATCH 09/25] Test --- test/Register-PackageSource.Tests.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/Register-PackageSource.Tests.ps1 b/test/Register-PackageSource.Tests.ps1 index e82d7dd..015399d 100644 --- a/test/Register-PackageSource.Tests.ps1 +++ b/test/Register-PackageSource.Tests.ps1 @@ -9,8 +9,12 @@ Describe Register-PackageSource { Write-Verbose -Message 'PSGallery already exists.' } - Get-PSResourceRepository -Name Test -ErrorAction Ignore | - Unregister-PSResourceRepository + try { + Unregister-PSResourceRepository -Name Test + } + catch { + Write-Verbose -Message 'Test not registered.' + } } Context 'with -Uri parameter' { From 70210751a33b1facb2aa150f06514a5aa7200f9e Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 18:26:22 -0500 Subject: [PATCH 10/25] Test --- test/Register-PackageSource.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Register-PackageSource.Tests.ps1 b/test/Register-PackageSource.Tests.ps1 index 015399d..20ac3ba 100644 --- a/test/Register-PackageSource.Tests.ps1 +++ b/test/Register-PackageSource.Tests.ps1 @@ -1,6 +1,6 @@ #requires -modules AnyPackage.PSResourceGet -Describe Register-PackageSource { +Describe Register-PackageSource -Skip { AfterEach { try { Register-PSResourceRepository -PSGallery From bad966e85b3d4f9c74d9280b36e13674d570cea7 Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 18:27:48 -0500 Subject: [PATCH 11/25] Test --- test/Register-PackageSource.Tests.ps1 | 2 +- test/Save-Package.Tests.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Register-PackageSource.Tests.ps1 b/test/Register-PackageSource.Tests.ps1 index 20ac3ba..015399d 100644 --- a/test/Register-PackageSource.Tests.ps1 +++ b/test/Register-PackageSource.Tests.ps1 @@ -1,6 +1,6 @@ #requires -modules AnyPackage.PSResourceGet -Describe Register-PackageSource -Skip { +Describe Register-PackageSource { AfterEach { try { Register-PSResourceRepository -PSGallery diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index 4486620..d55508e 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -52,7 +52,7 @@ Describe Save-Package { } Context 'with -Source parameter' { - BeforeEach { + BeforeAll { $path = Get-PSDrive TestDrive | Select-Object -ExpandProperty Root New-Item -Path $path/repo -ItemType Directory Register-PSResourceRepository -Name Test -Uri $path/repo -Trusted From 7b53c423cf6dd25bb6ffb03db89275cb3a409c1c Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 18:40:21 -0500 Subject: [PATCH 12/25] Test --- test/Save-Package.Tests.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index d55508e..c2fdf91 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -63,8 +63,8 @@ Describe Save-Package { Unregister-PSResourceRepository -Name Test } - It 'should save from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery'}, - @{ Name = 'AnyPackage'; Source = 'Test' } { + It 'should save from repository' -TestCases @{ Name = 'AnyPackage'; Source = 'Test' }, + @{ Name = 'SNMP'; Source = 'PSGallery'} { $savePackageParams = @{ Name = $Name Source = $Source From 99d857b45ddf30fe4ec66dfb0f53d33f73296ca8 Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 18:51:12 -0500 Subject: [PATCH 13/25] Test --- test/Save-Package.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index c2fdf91..4ed1183 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -55,7 +55,7 @@ Describe Save-Package { BeforeAll { $path = Get-PSDrive TestDrive | Select-Object -ExpandProperty Root New-Item -Path $path/repo -ItemType Directory - Register-PSResourceRepository -Name Test -Uri $path/repo -Trusted + Register-PSResourceRepository -Name Test -Uri $path/repo -Trusted -Force Save-PSResource -Name AnyPackage, SNMP -Path $path/repo -TrustRepository -AsNupkg } @@ -63,8 +63,8 @@ Describe Save-Package { Unregister-PSResourceRepository -Name Test } - It 'should save from repository' -TestCases @{ Name = 'AnyPackage'; Source = 'Test' }, - @{ Name = 'SNMP'; Source = 'PSGallery'} { + It 'should save from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery' }, + @{ Name = 'AnyPackage'; Source = 'PSGallery'} { $savePackageParams = @{ Name = $Name Source = $Source From a528e0199ea41a1217ef7f875563252a5e780247 Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 18:57:15 -0500 Subject: [PATCH 14/25] Test --- test/Save-Package.Tests.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index 4ed1183..a9f2790 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -55,7 +55,7 @@ Describe Save-Package { BeforeAll { $path = Get-PSDrive TestDrive | Select-Object -ExpandProperty Root New-Item -Path $path/repo -ItemType Directory - Register-PSResourceRepository -Name Test -Uri $path/repo -Trusted -Force + Register-PSResourceRepository -Name Test -Uri $path/repo -Trusted Save-PSResource -Name AnyPackage, SNMP -Path $path/repo -TrustRepository -AsNupkg } @@ -64,7 +64,9 @@ Describe Save-Package { } It 'should save from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery' }, - @{ Name = 'AnyPackage'; Source = 'PSGallery'} { + @{ Name = 'AnyPackage'; Source = 'Test'} { + + Get-ChildItem -Path "$(Get-PSDrive TestDrive | Select-Object -ExpandProperty Root)/repo" $savePackageParams = @{ Name = $Name Source = $Source From a11e508f165b139583be5fe336bef3faefda7c7b Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:06:33 -0500 Subject: [PATCH 15/25] Test --- test/Save-Package.Tests.ps1 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index a9f2790..42a9cf3 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -56,17 +56,15 @@ Describe Save-Package { $path = Get-PSDrive TestDrive | Select-Object -ExpandProperty Root New-Item -Path $path/repo -ItemType Directory Register-PSResourceRepository -Name Test -Uri $path/repo -Trusted - Save-PSResource -Name AnyPackage, SNMP -Path $path/repo -TrustRepository -AsNupkg + Save-PSResource -Name PSWindowsUpdate, SNMP -Path $path/repo -TrustRepository -AsNupkg } AfterAll { Unregister-PSResourceRepository -Name Test } - It 'should save from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery' }, - @{ Name = 'AnyPackage'; Source = 'Test'} { - - Get-ChildItem -Path "$(Get-PSDrive TestDrive | Select-Object -ExpandProperty Root)/repo" + It 'should save from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery'}, + @{ Name = 'PSWindowsUpdate'; Source = 'Test' } { $savePackageParams = @{ Name = $Name Source = $Source From b12c2745f1167c976f370e724c16b76e93dc2d73 Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:12:09 -0500 Subject: [PATCH 16/25] Test --- test/Save-Package.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index 42a9cf3..7f61c0d 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -68,7 +68,7 @@ Describe Save-Package { $savePackageParams = @{ Name = $Name Source = $Source - Path = (Get-PSDrive -Name TestDrive | Select-Object -ExpandProperty Root) + Path = (Get-PSDrive -Name Temp | Select-Object -ExpandProperty Root) PassThru = $true TrustSource = $true } From 7f2404a0d403f6b82ef9f7230b85f85e7308d419 Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:13:41 -0500 Subject: [PATCH 17/25] Test --- test/Save-Package.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index 7f61c0d..680a89c 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -52,10 +52,10 @@ Describe Save-Package { } Context 'with -Source parameter' { - BeforeAll { + BeforeEach { $path = Get-PSDrive TestDrive | Select-Object -ExpandProperty Root New-Item -Path $path/repo -ItemType Directory - Register-PSResourceRepository -Name Test -Uri $path/repo -Trusted + Register-PSResourceRepository -Name Test -Uri $path/repo -Trusted -Force Save-PSResource -Name PSWindowsUpdate, SNMP -Path $path/repo -TrustRepository -AsNupkg } @@ -68,7 +68,7 @@ Describe Save-Package { $savePackageParams = @{ Name = $Name Source = $Source - Path = (Get-PSDrive -Name Temp | Select-Object -ExpandProperty Root) + Path = (Get-PSDrive -Name TestDrive | Select-Object -ExpandProperty Root) PassThru = $true TrustSource = $true } From 6911336472401de30e02aca60ef9acc0501c0fee Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:21:28 -0500 Subject: [PATCH 18/25] Test older pester --- .github/workflows/ci.yml | 5 +++++ test/Save-Package.Tests.ps1 | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d980fdd..f00e1cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,11 @@ jobs: - name: Install PSResourceGet run: Install-Module Microsoft.PowerShell.PSResourceGet -AllowPrerelease -Force -AllowClobber + - name: Install Pester 5.4.0 + run: | + Install-Module Pester -RequiredVersion 5.4.0 -AllowClobber -Force + Import-Module Pester -RequiredVersion 5.4.0 + - name: Download module uses: actions/download-artifact@v3 with: diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index 680a89c..67efaa4 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -55,7 +55,7 @@ Describe Save-Package { BeforeEach { $path = Get-PSDrive TestDrive | Select-Object -ExpandProperty Root New-Item -Path $path/repo -ItemType Directory - Register-PSResourceRepository -Name Test -Uri $path/repo -Trusted -Force + Register-PSResourceRepository -Name Test -Uri $path/repo -Trusted Save-PSResource -Name PSWindowsUpdate, SNMP -Path $path/repo -TrustRepository -AsNupkg } From ebdee342985bcd065e20a2de9d808ddaa5343d34 Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:27:00 -0500 Subject: [PATCH 19/25] Test --- .github/workflows/ci.yml | 2 +- test/Save-Package.Tests.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f00e1cb..98a9540 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: - name: Install Pester 5.4.0 run: | - Install-Module Pester -RequiredVersion 5.4.0 -AllowClobber -Force + Install-PSResource Pester 5.4.0 Import-Module Pester -RequiredVersion 5.4.0 - name: Download module diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index 67efaa4..42a9cf3 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -52,7 +52,7 @@ Describe Save-Package { } Context 'with -Source parameter' { - BeforeEach { + BeforeAll { $path = Get-PSDrive TestDrive | Select-Object -ExpandProperty Root New-Item -Path $path/repo -ItemType Directory Register-PSResourceRepository -Name Test -Uri $path/repo -Trusted From 10690938ed607bc2530ed1b247455f22f3e1968d Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:28:45 -0500 Subject: [PATCH 20/25] Test --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98a9540..884b1b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: - name: Install Pester 5.4.0 run: | - Install-PSResource Pester 5.4.0 + Install-PSResource Pester -Version 5.4.0 Import-Module Pester -RequiredVersion 5.4.0 - name: Download module From 6def88b38ee7d53a09168b56fbd8db502e894c37 Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:34:47 -0500 Subject: [PATCH 21/25] Test --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 884b1b7..b5b8936 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: - name: Install Pester 5.4.0 run: | - Install-PSResource Pester -Version 5.4.0 + Install-PSResource Pester -Version 5.4.0 -TrustRepository Import-Module Pester -RequiredVersion 5.4.0 - name: Download module From f558ac611a2495b645e040ec0427916ec7b37b69 Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:38:41 -0500 Subject: [PATCH 22/25] Test --- .github/workflows/ci.yml | 5 ----- test/Install-Package.Tests.ps1 | 2 +- test/Save-Package.Tests.ps1 | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5b8936..d980fdd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,11 +43,6 @@ jobs: - name: Install PSResourceGet run: Install-Module Microsoft.PowerShell.PSResourceGet -AllowPrerelease -Force -AllowClobber - - name: Install Pester 5.4.0 - run: | - Install-PSResource Pester -Version 5.4.0 -TrustRepository - Import-Module Pester -RequiredVersion 5.4.0 - - name: Download module uses: actions/download-artifact@v3 with: diff --git a/test/Install-Package.Tests.ps1 b/test/Install-Package.Tests.ps1 index eaa9851..8833afb 100644 --- a/test/Install-Package.Tests.ps1 +++ b/test/Install-Package.Tests.ps1 @@ -50,7 +50,7 @@ Describe Install-Package { } It 'should install from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery'}, - @{ Name = 'PSWindowsUpdate'; Source = 'Test' } { + <# @{ Name = 'PSWindowsUpdate'; Source = 'Test' } #> { $results = Install-Package -Name $name -Source $source -PassThru $results.Source | Should -Be $source } diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index 42a9cf3..c6f7392 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -64,7 +64,7 @@ Describe Save-Package { } It 'should save from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery'}, - @{ Name = 'PSWindowsUpdate'; Source = 'Test' } { + <# @{ Name = 'PSWindowsUpdate'; Source = 'Test' } #> { $savePackageParams = @{ Name = $Name Source = $Source From acc2cc32e849834feccd861d386c23d84055327d Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:40:22 -0500 Subject: [PATCH 23/25] Test --- test/Install-Package.Tests.ps1 | 2 +- test/Save-Package.Tests.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Install-Package.Tests.ps1 b/test/Install-Package.Tests.ps1 index 8833afb..f1e1f52 100644 --- a/test/Install-Package.Tests.ps1 +++ b/test/Install-Package.Tests.ps1 @@ -49,7 +49,7 @@ Describe Install-Package { Unregister-PSResourceRepository -Name Test } - It 'should install from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery'}, + It 'should install from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery'} <# @{ Name = 'PSWindowsUpdate'; Source = 'Test' } #> { $results = Install-Package -Name $name -Source $source -PassThru $results.Source | Should -Be $source diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index c6f7392..302c4d1 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -63,7 +63,7 @@ Describe Save-Package { Unregister-PSResourceRepository -Name Test } - It 'should save from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery'}, + It 'should save from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery'} <# @{ Name = 'PSWindowsUpdate'; Source = 'Test' } #> { $savePackageParams = @{ Name = $Name From 295afaa22b497ac73fc9e20c01d2b135fb2dba5e Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:45:07 -0500 Subject: [PATCH 24/25] Test --- test/Install-Package.Tests.ps1 | 3 +-- test/Save-Package.Tests.ps1 | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/test/Install-Package.Tests.ps1 b/test/Install-Package.Tests.ps1 index f1e1f52..c07591c 100644 --- a/test/Install-Package.Tests.ps1 +++ b/test/Install-Package.Tests.ps1 @@ -49,8 +49,7 @@ Describe Install-Package { Unregister-PSResourceRepository -Name Test } - It 'should install from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery'} - <# @{ Name = 'PSWindowsUpdate'; Source = 'Test' } #> { + It 'should install from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery' } { $results = Install-Package -Name $name -Source $source -PassThru $results.Source | Should -Be $source } diff --git a/test/Save-Package.Tests.ps1 b/test/Save-Package.Tests.ps1 index 302c4d1..a9b68b0 100644 --- a/test/Save-Package.Tests.ps1 +++ b/test/Save-Package.Tests.ps1 @@ -63,8 +63,7 @@ Describe Save-Package { Unregister-PSResourceRepository -Name Test } - It 'should save from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery'} - <# @{ Name = 'PSWindowsUpdate'; Source = 'Test' } #> { + It 'should save from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery' } { $savePackageParams = @{ Name = $Name Source = $Source From 2fa11e751fb7bc5a857e53f898754413f62fa50d Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:48:37 -0500 Subject: [PATCH 25/25] Fix typo --- test/Update-Package.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Update-Package.Tests.ps1 b/test/Update-Package.Tests.ps1 index 6fb8e26..67c376a 100644 --- a/test/Update-Package.Tests.ps1 +++ b/test/Update-Package.Tests.ps1 @@ -63,7 +63,7 @@ Describe Update-Package { Unregister-PSResourceRepository -Name Test } - It 'should install from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery'}, + It 'should update from repository' -TestCases @{ Name = 'SNMP'; Source = 'PSGallery'}, @{ Name = 'PSWindowsUpdate'; Source = 'Test' } { $results = Update-Package -Name $name -Source $source -PassThru $results.Source | Should -Be $source