🌟 [Major]: Version and Prerelease inputs now control Pester#71
Open
Marius Storhaug (MariusStorhaug) wants to merge 10 commits into
Open
🌟 [Major]: Version and Prerelease inputs now control Pester#71Marius Storhaug (MariusStorhaug) wants to merge 10 commits into
Marius Storhaug (MariusStorhaug) wants to merge 10 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.
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>
…docs Address Copilot review threads on PR #71: - Helpers.psm1: when -Version is set but no satisfying installed version resolves, throw instead of silently importing an unconstrained module from PSModulePath (defeats deterministic selection, issue #68). Add -ErrorAction Stop to the unconstrained fallback so a missing module surfaces clearly. - README.md: the Version and GitHubVersion inputs have no action.yml default; correct the Default column from 'latest' to *(none)* (behavior 'empty installs latest' is already in the description) so users don't literally set Version: latest.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 9, 2026 11:18
View session
The repo PSScriptAnalyzer settings (.github/linters/.powershell-psscriptanalyzer.psd1) enforce PSAvoidLongLines with a 150-char max; the new throw line was 199 chars and failed the POWERSHELL super-linter. Shortened to a single 126-char message; the rationale remains in the preceding comment.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 9, 2026 11:22
View session
Aligns with the action helper-module naming standard: name the module after the action, not the generic Helpers. Invoke-Pester loads the shared framework Helpers module into the test session, so its own Helpers module was the primary source of the name collision that broke -ModuleName mocking in tested modules. Renames src/Helpers.psm1 to src/Invoke-Pester.Helpers.psm1 and updates the exec.ps1 and init.ps1 imports; keeps the framework Helpers usage (LogGroup). No runtime logic changed. Part of PSModule/Process-PSModule#364.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 9, 2026 11:39
View session
9 tasks
Copilot flagged that its should be it is (contraction) in two checkout-step comments; the same typo appears in all 11 test jobs, so corrected every occurrence for consistency.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 9, 2026 12:56
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.
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.Versionis set but no satisfying installed version can be resolved, instead of silently importing an unconstrained module; the no-Versionfallback now imports with-ErrorAction Stop.[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.