🩹 [Patch]: Ensure only the selected module version is loaded#74
Open
Marius Storhaug (MariusStorhaug) wants to merge 3 commits into
Open
🩹 [Patch]: Ensure only the selected module version is loaded#74Marius Storhaug (MariusStorhaug) wants to merge 3 commits into
Marius 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).
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 11, 2026 17:24
View session
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.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 12, 2026 09:55
View session
…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.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 12, 2026 10:00
View session
…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.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 12, 2026 10:21
View session
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 12, 2026 10:24
View session
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.
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.