Skip to content

Commit 5e217a1

Browse files
πŸ“– [Docs]: Document the Pester major-version lock for test files (#57)
The PowerShell Test Specification now documents how test files pin the Pester framework, so contributors declare the same major-version lock everywhere. ## Changed: the Test Specification documents the Pester version lock A new "Pester version" section shows the requirement each `*.Tests.ps1` file declares: ```powershell #Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '6.0.0'; MaximumVersion = '6.*' } ``` It explains that any `6.x` is accepted, that the Invoke-Pester action installs a matching version, and that GUID identity-pinning is an optional, separate control rather than part of the default lock. ## Technical Details - Adds a "Pester version" section to `src/docs/PowerShell/Modules/Test-Specification.md`. - Part of the dependency-management epic PSModule/Process-PSModule#356.
1 parent 509c752 commit 5e217a1

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

β€Žsrc/docs/PowerShell/Modules/Test-Specification.mdβ€Ž

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@
44

55
This document defines the structure and guidelines for writing Pester tests for PowerShell functions. The goal is to ensure consistency and comprehensive test coverage while maintaining clarity.
66

7+
## Pester version
8+
9+
Lock the test framework to a **major version** so a new Pester major cannot be adopted silently and break every suite at once. Declare it as the first line of each `*.Tests.ps1` file:
10+
11+
```powershell
12+
#Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '6.0.0'; MaximumVersion = '6.*' }
13+
```
14+
15+
- `ModuleVersion` + `MaximumVersion` accept any Pester `6.x`, so routine minor and patch updates flow in without a change here β€” only a new major requires a deliberate, reviewed bump.
16+
- The `MaximumVersion = '6.*'` wildcard locks to the major without a sentinel version; PowerShell enforces the range at discovery time.
17+
- The [Invoke-Pester](https://github.com/PSModule/Invoke-Pester) action installs a matching `6.x`, so the requirement and the installed version stay aligned.
18+
- Pinning module identity with a `GUID` is a separate, stricter supply-chain control β€” omit it for the default major-lock; add it only when identity assurance is required.
19+
720
## Test Structure
821

922
Each function is tested within a structured Pester `Describe` block that follows this hierarchy:

0 commit comments

Comments
Β (0)