Skip to content

test: pin requested-version import for PSGalleryModule and PSResourceGet#191

Merged
HeyItsGilbert merged 1 commit into
mainfrom
test/version-import-regression
Jun 12, 2026
Merged

test: pin requested-version import for PSGalleryModule and PSResourceGet#191
HeyItsGilbert merged 1 commit into
mainfrom
test/version-import-regression

Conversation

@HeyItsGilbert

Copy link
Copy Markdown
Member

Summary

Closes #44, #55. Will also close #48, #69, #94 after merge (no new code needed for those; see individual issue comments).

Test plan

  • .\build.ps1 StageFiles; Invoke-Pester Tests/PSGalleryModule.Type.Tests.ps1, Tests/PSResourceGet.Type.Tests.ps1 — 29 tests, 0 failures

🤖 Generated with Claude Code

…Get (#44, #55)

Adds regression tests for two fixed behaviours:

- PSGalleryModule (#44): when multiple versions are installed and an older
  one is explicitly requested, Import-PSDependModule receives that exact
  version (not the maximum). Mirrors the equivalent assertion already
  present in PSResourceGet.Type.Tests.ps1.

- PSResourceGet (#44): extends the existing 'Multiple installed versions'
  context with an import-version assertion (Test,Import action) to lock
  in the same guarantee for the PSResourceGet handler.

- PSGalleryModule (#55): Repository = $null skips Get-PSRepository and
  calls Install-Module without a -Repository argument, allowing
  PowerShellGet to search all registered repositories.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 12, 2026 23:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds/extends Pester coverage to ensure PSDepend imports the explicitly requested module version when multiple versions are installed, and that a $null repository value falls back to all registered repositories (no -Repository passed to Install-Module). This aligns with expected behavior for PSGalleryModule and PSResourceGet dependency types and guards against regressions for issues #44 and #55.

Changes:

  • Add PSGalleryModule test case asserting the requested version (not max installed) is passed to Import-PSDependModule and install is skipped.
  • Add PSResourceGet test case asserting requested version is used on Test, Import when multiple installed versions exist.
  • Add PSGalleryModule test case asserting $null repository skips validation and calls Install-Module without -Repository.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
Tests/PSGalleryModule.Type.Tests.ps1 Adds contexts covering requested-version import selection and $null repository fall-through behavior.
Tests/PSResourceGet.Type.Tests.ps1 Adds an Import assertion ensuring the requested version is imported when multiple versions are installed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

& $ScriptPath -Dependency $Dep -PSDependAction Test, Import
}
Should -Invoke -CommandName Import-PSDependModule -ModuleName PSDepend -Times 1 -Exactly `
-ParameterFilter { $Version.ToString() -eq '1.2.3' }
& $ScriptPath -Dependency $Dep -PSDependAction Test, Import
}
Should -Invoke -CommandName Import-PSDependModule -ModuleName PSDepend -Times 1 -Exactly `
-ParameterFilter { $Version.ToString() -eq '1.2.3' }
@github-actions

Copy link
Copy Markdown

Test Results

    3 files     66 suites   1m 13s ⏱️
  963 tests   905 ✅ 58 💤 0 ❌
1 290 runs  1 222 ✅ 68 💤 0 ❌

Results for commit 7e4eb3a.

@HeyItsGilbert HeyItsGilbert merged commit ddff015 into main Jun 12, 2026
8 checks passed
@HeyItsGilbert HeyItsGilbert deleted the test/version-import-regression branch June 12, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure AddToPath is Processes When PSDepend is Rerun Importing a PSGalleryModule dependency always imports the latest version

2 participants