Skip to content

Commit 1c5f864

Browse files
Document the Pester major-version lock for test files
1 parent 6c93677 commit 1c5f864

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/docs/PowerShell/Modules/Test-Specification.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@
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.999.999'; GUID = 'a699dea5-2c73-4616-a270-1f7abb777e71' }
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 `GUID` pins module identity (a name alone can be squatted). PowerShell enforces both the version range and the GUID 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+
719
## Test Structure
820

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

0 commit comments

Comments
 (0)