🚀 [Feature]: Make the Pester version configurable (default latest)#71
Draft
Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
Draft
🚀 [Feature]: Make the Pester version configurable (default latest)#71Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
Conversation
Add Pester_Version and Pester_Prerelease inputs so consumers can constrain the installed Pester (NuGet range syntax, e.g. [6.0.0,7.0.0)) while the action keeps defaulting to the latest version. This removes the need to bake a version lock into the shared action. Install-PSResourceWithRetry now installs the version satisfying the constraint and imports that exact version into the global session state, so the Pester that runs is deterministic even when the runner ships a different preinstalled Pester (previously PowerShell auto-loaded the highest version on PSModulePath). The 'test kit versions' output now reports the imported version via Get-Module. Relates to #68. Supersedes #70.
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.
Summary
Makes the Pester version a configurable input that defaults to latest, instead of baking a
major-version lock into the shared action (the approach in #70).
The framework's own dependency-management epic (PSModule/Process-PSModule#356) states the principle
directly: "Avoid staleness from over-locking… the default should track patches/minors, not freeze
forever," with locking modelled as a configurable policy layer (Latest / Lock Major / Lock Minor /
Lock Patch / Lock GUID) that is a per-consumer default with overrides. A hard
[6.0.0,7.0.0)lockcompiled into the action applies one policy to every consumer and can only be changed by editing the
action — the wrong layer for the decision.
What changed
Pester_Version— NuGet version-range syntax, e.g.[6.0.0,7.0.0)for any 6.x, or6.4.0for an exact version.Pester_Prerelease— allow prerelease versions.src/init.ps1/src/exec.ps1install Pester using those inputs (default latest) instead of a hardcoded range.Install-PSResourceWithRetry:Invoke-Pesterruns is the resolved one — even though GitHub runners ship a preinstalled Pester. Previously the helper'sImport-Modulelanded in the module's own scope andInvoke-Pesterrelied on PowerShell auto-loading the highest version onPSModulePath, which is the non-determinism behind the 2026-07-05 breakage.Get-Module) rather than the highest installed.Why this is "more open"
#Requires -Modules @{ Pester 6.x }in test files remains valid and complementary: it's the per-repo declaration / safety net (PowerShell errors if the installed Pester doesn't satisfy it), not a duplicate lock.Validation
Install-PSResourceWithRetryverified against the real gallery in isolated processes:[5.0.0,6.0.0)→ loads 5.9.0,[6.0.0,7.0.0)→ loads 6.0.0, empty → loads latest (6.0.0).Action-Test.ymlfixtures.Follow-ups (not in this PR)
PesterVersionsetting and threadPester_Versioninto theInvoke-Pestersteps inTest-ModuleLocal.yml/Test-SourceCode.yml, then bump the pin to this action's next release. This is where the org-wide "6.x" default should live (overridable per repo).#Requiresdeclaration layer.Pester_Guidinput for Lock-GUID identity pinning (the remaining part of 🚀 [Feature]: Install the pinned Pester version — support #Requires-style version constraints on the Version input #68).Relates to #68. Supersedes #70 (which can be closed in favour of this).