Skip to content

Commit 337533c

Browse files
Upgrade framework Pester baseline
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 8414050 commit 337533c

7 files changed

Lines changed: 44 additions & 11 deletions

File tree

.github/actions/Get-PesterCodeCoverage/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Summary:
7777

7878
## Requirements
7979

80-
1. **Pester Code Coverage Reports**
80+
1. **Pester 6.1 Code Coverage Reports**
8181
Preceding steps must generate JSON coverage reports named `*-CodeCoverage*.json`
8282

8383
2. **GitHub CLI**

.github/actions/Test-PSModule/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ runs:
288288
with:
289289
Debug: ${{ inputs.Debug }}
290290
Verbose: ${{ inputs.Verbose }}
291+
Version: '[6.1.0,7.0.0)'
292+
Prerelease: false
291293
GitHubVersion: ${{ inputs.Version }}
292294
GitHubPrerelease: ${{ inputs.Prerelease }}
293295
WorkingDirectory: ${{ inputs.WorkingDirectory }}

.github/actions/Test-PSModule/src/tests/Module/PSModule/PSModule.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if ($hasClassExporter) {
4343

4444

4545
# Run-phase setup — recompute from $Path so that It/Context blocks can use these variables.
46-
# Pester v5 Discovery and Run are separate executions. The script-scope variables above drive
46+
# Pester 6 Discovery and Run are separate executions. The script-scope variables above drive
4747
# -Skip and -ForEach during Discovery. This BeforeAll recomputes the same values for the Run
4848
# phase, where It blocks actually execute. The duplication is intentional and required.
4949
BeforeAll {

.github/workflows/Test-Actions.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,33 @@ jobs:
3434
- name: Install test dependencies
3535
shell: pwsh
3636
run: |
37-
Install-PSResource -Name Pester -Version '[5.7.1,6.0.0)' -Repository PSGallery -TrustRepository
37+
Install-PSResource -Name Pester -Version '[6.1.0,7.0.0)' -Repository PSGallery -TrustRepository
3838
Install-PSResource -Name PSSemVer -Repository PSGallery -TrustRepository
3939
Install-PSResource -Name GitHub -Version '[0.43.1,0.44.0)' -Repository PSGallery -TrustRepository
4040
4141
- name: Run action unit tests
4242
shell: pwsh
4343
run: |
44+
$configuration = New-PesterConfiguration
45+
$configuration.Run.Shuffle = $true
46+
$configuration.Run.ShuffleSeed = 42
47+
$configuration.Run.Parallel = $true
48+
$configuration.Run.ParallelThrottleLimit = 2
49+
$configuration.Debug.ShowStartMarkers = $true
50+
51+
$expectedOptions = @{
52+
'Run.Shuffle' = $configuration.Run.Shuffle.Value
53+
'Run.ShuffleSeed' = $configuration.Run.ShuffleSeed.Value -eq 42
54+
'Run.Parallel' = $configuration.Run.Parallel.Value
55+
'Run.ParallelThrottleLimit' = $configuration.Run.ParallelThrottleLimit.Value -eq 2
56+
'Debug.ShowStartMarkers' = $configuration.Debug.ShowStartMarkers.Value
57+
}
58+
foreach ($option in $expectedOptions.GetEnumerator()) {
59+
if (-not $option.Value) {
60+
throw "Pester 6.1 configuration option [$($option.Key)] was not applied."
61+
}
62+
}
63+
4464
$testPaths = Get-ChildItem -Path '.github/actions' -Directory |
4565
ForEach-Object { Join-Path -Path $_.FullName -ChildPath 'tests' } |
4666
Where-Object { Test-Path -Path $_ }

.github/workflows/Test-ModuleLocal.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ jobs:
7272
uses: PSModule/Invoke-Pester@4ff33199141fdf22568990b6107fe3148ae93a1c # v5.1.0
7373
with:
7474
Debug: ${{ fromJson(inputs.Settings).Debug }}
75-
Prerelease: ${{ fromJson(inputs.Settings).Prerelease }}
75+
Prerelease: false
7676
Verbose: ${{ fromJson(inputs.Settings).Verbose }}
77-
Version: ${{ fromJson(inputs.Settings).Version }}
77+
Version: '[6.1.0,7.0.0)'
78+
GitHubVersion: ${{ fromJson(inputs.Settings).Version }}
79+
GitHubPrerelease: ${{ fromJson(inputs.Settings).Prerelease }}
7880
TestResult_TestSuiteName: ${{ matrix.TestName }}-${{ matrix.OSName }}
7981
TestResult_Enabled: true
8082
CodeCoverage_Enabled: true

docs/content/guides/writing-module-tests.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,24 @@ been built and imported.
1111

1212
## Pester version
1313

14-
Module test files declare a Pester **6.x** requirement at the top of each `*.Tests.ps1`:
14+
Module test files declare a Pester **6.1.x** requirement at the top of each `*.Tests.ps1`:
1515

1616
```powershell
17-
#Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '6.0.0'; MaximumVersion = '6.*' }
17+
#Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '6.1.0'; MaximumVersion = '6.*' }
1818
```
1919

20-
This is a convention module authors add, not something the pipeline injects. The
21-
[Invoke-Pester](https://github.com/PSModule/Invoke-Pester) action installs a matching `6.x`, so minor and patch updates
22-
flow in automatically while a new major stays a deliberate, reviewed change.
20+
This is a convention module authors add. Process-PSModule pins its reusable
21+
[Invoke-Pester](https://github.com/PSModule/Invoke-Pester) action runs to the
22+
`[6.1.0,7.0.0)` range, so patch updates flow in automatically while a new
23+
major stays a deliberate, reviewed change.
24+
25+
Pester 6.1 adds opt-in controls for shuffled and parallel file execution
26+
(`Run.Shuffle`, `Run.ShuffleSeed`, `Run.Parallel`, and
27+
`Run.ParallelThrottleLimit`) and diagnostic start markers
28+
(`Debug.ShowStartMarkers`). These controls are available when invoking Pester
29+
directly with `New-PesterConfiguration`. Process-PSModule's reusable action will
30+
expose them after the coordinated `PSModule/Invoke-Pester` action adds matching
31+
inputs; the current v5.1.0 action contract does not accept them.
2332

2433
## Test discovery
2534

docs/content/reference/powershell-module-standard.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ Process-PSModule derives `TestName` from the file's basename before the first do
319319
Each `*.Tests.ps1` file must declare the Pester 6 requirement:
320320

321321
```powershell
322-
#Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '6.0.0'; MaximumVersion = '6.*' }
322+
#Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '6.1.0'; MaximumVersion = '6.*' }
323323
```
324324

325325
Tests run against the built module artifact installed locally, across a multi-OS matrix (Linux, macOS, Windows). The full suite must also remain runnable locally without mandatory cloud resources, special access, or secrets that cannot be mocked.

0 commit comments

Comments
 (0)