Uh oh!
There was an error while loading. Please reload this page.
🩹 [Patch]: Ensure only the selected module version is loaded - #74
🩹 [Patch]: Ensure only the selected module version is loaded#74Marius Storhaug (MariusStorhaug) wants to merge 3 commits into
Conversation
Install-PSResourceWithRetry now removes any already-loaded versions of the module from the session before importing the resolved version, so the selected version is the only one loaded (not a side-by-side or runner-preinstalled copy).
There was a problem hiding this comment.
Pull request overview
This PR tightens module determinism for the GitHub Action by ensuring that the module version resolved via the Version/Prerelease inputs is the only version loaded in the current PowerShell session.
Changes:
- Updates
Install-PSResourceWithRetryto remove already-loaded module versions before importing the resolved version. - Adjusts comment-based help text to reflect the “only loaded version” behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…n prerelease-aware Per PR review: use 'Get-Module -Name \ -All | Remove-Module' so every loaded instance (all versions, including nested) is removed before import; and when Prerelease is not requested, exclude prerelease candidates from resolution and add a stable-wins tie-breaker so a prerelease is never selected over a stable of the same base version.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…ore unloading Filter/sort on the PSResourceGet 'Prerelease' string (present on both Install-PSResource and Get-InstalledPSResource output) instead of IsPrerelease; and move the unresolvable-constraint throw before Get-Module|Remove-Module so session state is not mutated when the function is going to fail.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Makes the version selected through the
Version/Prereleaseinputs the only version of the module that is installed and loaded in the session, for every module the action provisions throughInstall-PSResourceWithRetry(Pester and its helper modules).Fixed: only the selected module version is loaded
Install-PSResourceWithRetrynow:Prerelease— when prerelease versions are not requested it never resolves to one, with a stable-wins tie-breaker when a stable and a prerelease share the same base version (uses the PSResourceGetPrereleasestring).Get-Module -Name $Name -All | Remove-Module) so no side-by-side version remains.-RequiredVersion … -Force -Globalso the loaded module is deterministic rather than whatever PowerShell auto-loads fromPSModulePath.Technical Details
src/Invoke-Pester.Helpers.psm1: prerelease-aware resolution (filter + tie-breaker), fail-fast before unload, remove-all-instances, and updated function help.