🌟 [Major]: Version inputs now configure Pester#71
Draft
Marius Storhaug (MariusStorhaug) wants to merge 6 commits into
Draft
🌟 [Major]: Version inputs now configure Pester#71Marius Storhaug (MariusStorhaug) wants to merge 6 commits into
Marius Storhaug (MariusStorhaug) wants to merge 6 commits 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.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 8, 2026 22:44
View session
There was a problem hiding this comment.
Pull request overview
This PR adds workflow-configurable Pester version selection to the PSModule/Invoke-Pester GitHub Action, while keeping the default behavior of installing the latest Pester when no constraint is provided. It wires new action inputs through to the init/exec phases, updates the install/import logic to load the resolved module version deterministically, and adds CI coverage for both a Pester 5.x range and an exact Pester 6.0.0 pin.
Changes:
- Added
PesterVersionandPesterPrereleaseinputs and propagated them viaPSMODULE_INVOKE_PESTER_INPUT_*environment variables. - Updated
Install-PSResourceWithRetryto install with optional version/prerelease constraints and import the resolved module version globally. - Added Action-Test workflow jobs and test suites validating a Pester 5.x range constraint and an exact Pester 6.0.0 constraint.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
action.yml |
Adds new inputs and passes them into init/exec environment variables. |
src/init.ps1 |
Installs/imports Pester using the new inputs; logs loaded Pester via Get-Module. |
src/exec.ps1 |
Mirrors init behavior for exec/eval phases; logs loaded Pester via Get-Module. |
src/Helpers.psm1 |
Extends installer helper to pass -Version/-Prerelease, resolve installed version, and import deterministically. |
README.md |
Documents the new inputs and the deterministic import behavior. |
.github/workflows/Action-Test.yml |
Adds CI jobs to validate Pester version range/exact constraints. |
tests/Test-ActionResults.ps1 |
Aggregates new Action-Test job results into the summary table. |
tests/4-PesterVersionConstraints/Pester5Range/PesterVersion.Tests.ps1 |
New test verifying a resolved Pester 5.x version satisfies bounds. |
tests/4-PesterVersionConstraints/Pester6Exact/PesterVersion.Tests.ps1 |
New test verifying exact Pester 6.0.0 is loaded. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1374
to
+1379
| if ($resolved) { | ||
| Write-Output "Importing module: $Name $($resolved.Version)" | ||
| Import-Module -Name $Name -RequiredVersion $resolved.Version -Force -Global -ErrorAction Stop | ||
| } else { | ||
| Import-Module -Name $Name -Force -Global | ||
| } |
Comment on lines
+264
to
+268
| | **Input** | **Description** | **Default** | | ||
| |--------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------| | ||
| | `Path` | Path to where tests are located or a configuration file. | *(none)* | | ||
| | `PesterVersion` | Version of Pester to install (NuGet range, e.g. `[6.0.0,7.0.0)` for any 6.x). Empty installs the latest version. | `latest` | | ||
| | `PesterPrerelease` | Allow installing prerelease versions of Pester. | `false` | |
Bumps [PSModule/GitHub-Script](https://github.com/PSModule/GitHub-Script) from 1.8.0 to 1.9.0. - Pin: `8083ec1f733f00357ee4d0db0c6056686e483bc0` (`# v1.9.0`) - Release notes: https://github.com/PSModule/GitHub-Script/releases/tag/v1.9.0 Co-authored-by: Marius Storhaug <Marius.Storhaug@dnb.no>
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.
Invoke-Pester now treats
VersionandPrereleaseas Pester controls. Workflows that previously used those inputs to choose the GitHub PowerShell module used by the init bootstrap step must rename them toGitHubVersionandGitHubPrerelease. Workflows that did not setVersionorPrereleasekeep installing the latest available Pester by default.Breaking Changes
VersionandPrereleasenow apply to Pester, not the GitHub PowerShell module used internally during init.Before this change, a workflow like this selected the GitHub module version:
After this change, use the GitHub-prefixed inputs for the bootstrap module:
Use
VersionandPrereleaseonly when selecting the Pester version that should run the test suite:New: Pester version selection per workflow
Versionaccepts NuGet version syntax, including bare exact versions such as6.0.0, exact-match ranges such as[6.0.0], and bounded ranges such as[5.0.0,6.0.0). WhenVersionis empty, the action installs the latest available Pester version.Prereleasecontrols whether prerelease Pester versions are allowed.Changed: GitHub bootstrap versioning is GitHub-prefixed
The GitHub PowerShell module used by the init bootstrap step remains configurable, but its inputs are now
GitHubVersionandGitHubPrereleaseso they do not conflict with the action's Pester-focused inputs.GitHubVersionalso documents NuGet version-range syntax and is passed through to the GitHub-Script action'sVersioninput. A bare version stays exact, matching the NuGet/PSResourceGet behavior described in PSModule/GitHub-Script#97.Changed: Latest remains the default Pester behavior
Existing consumers can omit
Versionto keep installing the latest available Pester version. Teams that need a cap or exact version can set it in workflow configuration, while per-repository#Requiresdeclarations remain the safety net that fails tests when the loaded Pester does not satisfy the repository's requirement.Fixed: The loaded Pester version matches the selected version
The action now imports the exact Pester version resolved from the configured constraint. Version reporting also reflects the loaded module, so workflow logs show the Pester version that actually runs the tests.
Technical Details
VersionandPrereleaseare owned by Pester.GitHubVersionandGitHubPrerelease, then pass them through toPSModule/GitHub-Scriptas itsVersionandPrereleaseinputs.PSMODULE_INVOKE_PESTER_INPUT_VersionandPSMODULE_INVOKE_PESTER_INPUT_Prerelease.Install-PSResourceWithRetryto pass-Version,-Prerelease, and-PassThrutoInstall-PSResource, resolve the installed/satisfying version, and import it globally withImport-Module -RequiredVersion ... -Global -ErrorAction Stop.Get-PSResourcetoGet-Moduleso logs report the loaded version rather than the highest installed resource.[5.0.0,6.0.0)) and exact Pester6.0.0; both constraint jobs pass in CI.[6.0.0,7.0.0)action-level lock and leaves GUID identity pinning as a later enhancement for 🚀 [Feature]: Install the pinned Pester version — support #Requires-style version constraints on the Version input #68.