Migrate Find-Package and Get-Package E2E tests to unit tests#7526
Merged
Conversation
Contributor
|
This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR continues the migration of legacy PowerShell end-to-end tests for Find-Package and Get-Package into faster in-process unit tests under NuGetConsole.Host.PowerShell.Test, deleting the old .ps1 test files and updating related migration guidance.
Changes:
- Added unit tests covering paging (
-First/-Skip), version collapsing, and-Source-by-name behavior forFind-Package/Get-Package. - Deleted the legacy E2E test scripts
FindPackageTest.ps1andGetPackageTest.ps1and removed them fromNuGet.slnsolution items. - Updated the apex-migration skill documentation; also re-enabled one previously skipped E2E test in
InstallPackageTest.ps1.
Show a summary per file
| File | Description |
|---|---|
| test/NuGet.Clients.Tests/NuGetConsole.Host.PowerShell.Test/Cmdlets/GetPackageCommandTests.cs | Adds unit tests for Get-Package behaviors (collapse versions, paging beyond 100, source-name resolution, updates filtering) and a helper overload for named sources. |
| test/NuGet.Clients.Tests/NuGetConsole.Host.PowerShell.Test/Cmdlets/FindPackageCommandTests.cs | Adds unit tests for Find-Package paging behavior with -First and -Skip. |
| test/EndToEnd/tests/InstallPackageTest.ps1 | Removes a SkipTest attribute, re-enabling Test-InstallPackageWithValuesFromPipe. |
| test/EndToEnd/tests/GetPackageTest.ps1 | Deletes legacy E2E tests now covered by unit tests. |
| test/EndToEnd/tests/FindPackageTest.ps1 | Deletes legacy E2E tests now covered by unit tests. |
| NuGet.sln | Removes deleted E2E scripts from solution items. |
| .copilot/skills/apex-migration/SKILL.md | Documents learnings and guidance from this paging/source-name migration. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Low
nkolev92
marked this pull request as ready for review
July 6, 2026 20:13
jebriede
reviewed
Jul 6, 2026
nkolev92
enabled auto-merge (squash)
July 13, 2026 16:42
martinrrm
previously approved these changes
Jul 13, 2026
jebriede
previously approved these changes
Jul 14, 2026
jebriede
left a comment
Contributor
There was a problem hiding this comment.
Approve with test suggestion
nkolev92
force-pushed
the
dev-nkolev92-cleanup
branch
from
July 15, 2026 01:16
8c5b4fe to
6bfe835
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use exact, ordered sequence assertions in FindPackageCommandTests instead of count-based/Contain checks, relying on the deterministic ordering of the local package source (ids ascending, versions descending). The paging test now verifies the skip offset window, not just the result count. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nkolev92
force-pushed
the
dev-nkolev92-cleanup
branch
from
July 15, 2026 16:37
6bfe835 to
cdb3300
Compare
jebriede
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
Progress: https://github.com/NuGet/Client.Engineering/issues/2085
Fixes: NuGet/Home#8496
Description
Continues the migration of legacy PowerShell end-to-end tests (
test/EndToEnd/tests/*.ps1) to fast, in-process unit tests, following the repo's apex-migration playbook.This PR migrates the last remaining functions in
FindPackageTest.ps1andGetPackageTest.ps1. Both files are deleted and removed fromNuGet.sln. Every scenario describes pureFind-Package/Get-Packagecmdlet behavior (paging, version collapsing, source-name resolution), so all were migrated as unit tests inNuGetConsole.Host.PowerShell.Testrather than Apex tests — no VS integration is required to exercise them. VS-level source resolution is already covered by the existingGetPackage_InstallListAndUpdateLifecycleAsyncApex test.Test migration mapping
Test-FindPackageByIdWithFirstAndSkip(FindPackageTest.ps1)FindPackage_WithFirst_LimitsNumberOfResultsAsync,FindPackage_WithSkipBeyondResultCount_ReturnsEmptyAsync,FindPackage_WithFirstAndSkip_ReturnsLimitedResultsAsync-First/-Skippaging split into focused casesTest-GetPackageCollapsesPackageVersionsForListAvailable(GetPackageTest.ps1)GetPackageListAvailable_CollapsesMultipleVersionsToSingleEntryAsyncTest-GetPackageRetunsMoreThanServerPagingLimit(GetPackageTest.ps1)GetPackageListAvailable_WithLargeFirst_ReturnsMoreThanServerPagingLimitAsync-First;-ListAvailabledefaultsFirst=50Test-GetPackageAcceptsSourceName(GetPackageTest.ps1)GetPackageListAvailable_WithSourceByName_ReturnsPackagesAsync-Source <name>resolved via mocked package source providerTest-GetPackageWithUpdatesAcceptsSourceName(GetPackageTest.ps1)GetPackageUpdates_WithSourceByName_ReturnsUpdatesAsync-Updates -Source <name>returns updatesTest-GetPackageUpdatesAfterSwitchToSourceThatDoesNotContainInstalledPackageId(GetPackageTest.ps1)GetPackageUpdates_FromSourceWithoutInstalledPackage_ReturnsEmptyAsync-Updatesagainst a source lacking the installed id returns 0GetPackageAcceptsAllAsSourceName(GetPackageTest.ps1)-Source 'All'is a host-level (PMC dropdown) concept handled byPowerShellHost, not a cmdlet-Sourcevalue — passing it literally throws "Unknown source 'All'". The function also lacked aTest-prefix, so it never ran.Files changed
FindPackageCommandTests.csand 5 toGetPackageCommandTests.cs(plus aSetupSourceRepositoryProvider(IEnumerable<PackageSource>)overload for source-name scenarios).FindPackageTest.ps1andGetPackageTest.ps1; removed theirNuGet.slnsolution items.This branch also carries earlier cleanup commits (dead-code removal in
LocalPackageSearchResource+ tests,VSSolutionManager,ProjectSystemCacheTests, package version housekeeping).PR Checklist