From 8735429fbca99c47e117f9bb8d236b843000eb4b Mon Sep 17 00:00:00 2001 From: Claudio Mendes Date: Tue, 6 Oct 2026 22:22:01 +0200 Subject: [PATCH] Upgrade validation suite to Pester 6.2.0 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/pull_request_template.md | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- CHECKSUMS.txt | 16 ++++++++-------- Tests/Runtime.Tests.ps1 | 13 ++++++++++++- build/Invoke-Validation.ps1 | 2 +- docs/release-process.md | 2 +- docs/validation.md | 4 ++-- 8 files changed, 29 insertions(+), 18 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index bc5ab46..8911f80 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,7 +6,7 @@ Describe the change and why it is needed. - [ ] `build\Invoke-Validation.ps1` passes on Windows PowerShell 5.1 - [ ] PSScriptAnalyzer returns no findings -- [ ] Pester 5.7.1 discovery and tests pass +- [ ] Pester 6.2.0 discovery and tests pass - [ ] Full validation runs without `-SkipChecksums`; manifest matches worktree and candidate `git archive` - [ ] Live results are recorded separately, with untested scenarios explicitly pending - [ ] Documentation updated if behavior changed diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53eefd9..fdaef8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,9 @@ jobs: if (-not (Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue)) { Register-PSRepository -Default } - Install-Module Pester -RequiredVersion '5.7.1' -Repository PSGallery -Scope CurrentUser -Force + Install-Module Pester -RequiredVersion '6.2.0' -Repository PSGallery -Scope CurrentUser -Force Install-Module PSScriptAnalyzer -RequiredVersion '1.25.0' -Repository PSGallery -Scope CurrentUser -Force - Import-Module Pester -RequiredVersion '5.7.1' -Force + Import-Module Pester -RequiredVersion '6.2.0' -Force Import-Module PSScriptAnalyzer -RequiredVersion '1.25.0' -Force $ValidationParameters = @{} if ($env:GITHUB_REF -like 'refs/tags/*') { diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e55d66..d15d218 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,9 +32,9 @@ jobs: if (-not (Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue)) { Register-PSRepository -Default } - Install-Module Pester -RequiredVersion '5.7.1' -Repository PSGallery -Scope CurrentUser -Force + Install-Module Pester -RequiredVersion '6.2.0' -Repository PSGallery -Scope CurrentUser -Force Install-Module PSScriptAnalyzer -RequiredVersion '1.25.0' -Repository PSGallery -Scope CurrentUser -Force - Import-Module Pester -RequiredVersion '5.7.1' -Force + Import-Module Pester -RequiredVersion '6.2.0' -Force Import-Module PSScriptAnalyzer -RequiredVersion '1.25.0' -Force - name: Validate tagged revision diff --git a/CHECKSUMS.txt b/CHECKSUMS.txt index 9988173..b4f92a9 100644 --- a/CHECKSUMS.txt +++ b/CHECKSUMS.txt @@ -1,31 +1,29 @@ -04C3AB0325C43DCBBABB51C07882A7D023911292B9C5EF7A9CF0AA35248CF218 examples/git-configuration.md +04C3AB0325C43DCBBABB51C07882A7D023911292B9C5EF7A9CF0AA35248CF218 examples/git-configuration.md 093EF51AAA72A049F9C5C3A951C5C04FCCE0A7BD8F8E836B8C3DBC1FE2009447 .github/ISSUE_TEMPLATE/compatibility_report.yml 12A4DBEF78D055AF2194599FF3D17359A9F4E033BBB6BB8C2EF2BC83F64BBDF0 assets/validation-pass.svg 16E3989EAD7E2899AF3EAB14232582152DF7FD1A6B24D389781D3347A7900703 docs/architecture.md -1CD0B3D1D7AF4679C5A22719013B0A022B26C4A9BDB98458C33326701F226442 docs/validation.md 1ED4E3E647F752AD7D7CAFC8E3D4074612593ED9AD21B9B66B96BAD4266211B0 build/Update-Banners.ps1 +211B1889B15D97E6D213E009663BADA6E8C0DC50A8F8C647A23FE17A34231947 .github/pull_request_template.md 229B99CB364794905604F3DF1AF743818B87BEF3285AEA2D8F9E2EF7110BEBE6 LICENSE 22D6D77DC30B753FC74E513EFE398EF4DA6E8A6AE62D0D3DE0C922F03A1ABC75 .github/CODEOWNERS 29648B9E8D00A9B27A6264289E5B10703B14E80C036E91FF8C00E8BBCD2E5800 RELEASE-NOTES.md -2C27E2BC49D315F94F25771528BA87C94191D472975CA9EB9FC2799966F88E00 build/Invoke-Validation.ps1 2CC8992E8DA313F6CBC6D7751BB734BBECBA643B795B37D34057B4DE553F8C7F .gitignore 2E2102953B196CE96FA75D81444AF56E3A249A5E5B07C9FB181F65BC0DB09489 .editorconfig 33E160714B21F67E4CF6A4758756277A6DB8EFA7F5FD181A1176C1D159B7D2C4 _layouts/default.html 3506A8BEAF4110E30F2E125D618E0C44476E173AD92283A4DDD90C0B71F92D60 CHANGELOG.md 35388D74DC4D7174B5AC058CCE5FB512C88240DF4DB086EE0A81C9AFA3613717 .vscode/tasks.json -35A95F5544EF8F1E89468586D35D40B8DAC50707BD9B2993275DA7ED8159985C .github/workflows/ci.yml 38A871D48BEB9A98E14B4D06B3056556C77924C448FC9DFCF70BF1DE22405F54 assets/banner-compact.svg 3A844B374BDB13EAFC32E96ACD1562E463BC740867741CCA374B086C65F90D4F .gitattributes 440BC84BE1D09C5CD51366D32552B8318B8EB03D67ED3E02F8B4B179E087834D docs/logging.md +468E4648770DF273D018BC90F5DABD85E00BD5BBE6EFD9106EB436E278A8FE78 .github/workflows/ci.yml 4B1611351ADB567EAB568A68F6AFFA34BEC6652B600FABD327DDD9046A8B73FF docs/compatibility.md 51CA47A0CB49C782EC8BE60AA583A6EA828160347E1F44649506C300AC097670 assets/banner.svg 52E276805DC7BF24E12221266965614B2BBFC50270CFF3C2AD2B103B755CEF0F Scripts/Copy-OSDLogToFileShare.ps1 56531E99444653248D308A7918DAE6A7D8F8C0FB3B41FE055200FDA8538BECC6 assets/branding.json 59854984853104DF5C353E2F681A15FC7924742F9A2E468C29AF248DCE45CE03 VERSION 5EDEC4DF1E3DCD2B4995EFC7C49F18A2FB25E954426A59F9B93DC4FF4F74A712 assets/task-sequence-flow-compact.svg -64AE12558D97232F023A0F740C745FC0066C12EF580839FC181E6BF3B87DEDC4 docs/release-process.md 670ABB6E09B7A198A30361A18A4C0372FC11F58D9C109BB74F86F2C29D8ECD1F assets/css/style.scss -688731E9934980B71C3D7A5CE0364469798C32A180FB65ECA4E3EBA6AB5793BF .github/workflows/release.yml +673E4DF350435A04825080E789E780A835203A53CB4D28EE3C8EFB47B69EC220 docs/validation.md 69BC45DC42B9ACB96A69823ADBC6AE538374E3C0BDE169B855B32C48EAAEF52F assets/fluentui-LICENSE.txt 69F12A25E2A40AF8310C956B716AD68B3006298278312C248FA6E3663B4F8A07 assets/copylog-flow.svg 6B6C7716FFCC77DF0FFA9D5E082E5040EDD2C3659C3842983D049E623B3821EF examples/README.md @@ -46,18 +44,20 @@ AE0EBC700A81F090A59935F13672E9109DE6616D49E8FADC36003028DEB94202 docs/developme B742325E364BD5B9A311B00BEC3016E30B13274A1A4E8326A131A00E54EA7204 assets/favicon.svg B8487D129B5573E9D7C7239FBF916D73373FC331F431D397194801FD08CA4812 SUPPORT.md B89C96E15A6A3E62D37649DDDD383BE8A7FECA7CA3ABD3F2911956BA39E1671D _config.yml +BB11493CAE1C3A5399A3259591473A35C71682AF903DE64C739AD296C5A4B014 .github/workflows/release.yml +BE400903F0FDBF54CA82A05AA16EC426300331EB21E28E894AD149B36DD8AE98 build/Invoke-Validation.ps1 BF528DC4807B5CD45B9513F4154551F3BD8BFDAD9BB4BA12A80C3FCBB7283063 .vscode/extensions.json +C1D445D112ECB795B5BC9E2ADE0F7289AEC0F4B20AF6274B28F02F8D90C64721 Tests/Runtime.Tests.ps1 C92B63FE51F8793EECE9953ECD496046F6180F740D50E60C36628ECACF09EF0C Tests/Validation.Tests.ps1 CD206D807913077F8D0786FB344CC37758AE3080922EAA7AEFF0B78ABAB0665C .github/ISSUE_TEMPLATE/feature_request.yml CE5DD8FA7FF72122B07DB4CA7CD5A35656ED0D1A813EC8568AA448F3227401AF CONTRIBUTING.md D52119CD9D85F9211A078959331CF7C3304AEBC11D1900D3ECAF67AFDFF9AA37 Tests/Distribution.Tests.ps1 D53A73DF9FAEC678D2471E63C070672BE9A6EAC355B451DF9BF3776802A47446 assets/task-sequence-flow.svg -D7498AD29F9F2014834DD8E8183D41E41D45DF9D4ABC2A93D8F00C675D6763D7 Tests/Runtime.Tests.ps1 DF3A074261544800B739DEE93B071DE5383EFE796B874D7673AD69A5548F7A4A .github/FUNDING.yml E04EB0FF50646904CEF5B2C142F5D84084DC5AA9A339D2D3A6BA9FCF0D2A1D7E index.md E204B2838AA20F8FEBDF74129FDC504C69809CF7044D03E90866E36BAD023DA6 SECURITY.md E49B0BAD89C4CAF2A07BB3FA625FF431977115A81A39B455061E96534BE291A0 .github/dependabot.yml +ED325EAC9FDC9E81E30D660A7F94659C0D0D6993193E1287D1C273395E1CE8D0 docs/release-process.md EE0B804F022C45EAC607A57181B672537C569787448D8C4BB31222CB50F7D43D Tests/Documentation.Tests.ps1 -EFB5564544D49377DC1DACC2970D445FDCBC5E689DA7B4E5501267549622E2E2 .github/pull_request_template.md FB8E54D166ABBAE9FE74FBC83C3CEC617C245EE5330E9E09724DEE35D7C0C313 docs/troubleshooting.md FBAF37306C261D6213F85AAE6A8B26233906E6BC48F345F9BC546D89538D226A docs/deployment.md diff --git a/Tests/Runtime.Tests.ps1 b/Tests/Runtime.Tests.ps1 index a412d16..4466362 100644 --- a/Tests/Runtime.Tests.ps1 +++ b/Tests/Runtime.Tests.ps1 @@ -410,7 +410,18 @@ Describe 'Runtime behavior' { } $script:MappingCommand = [pscustomobject]@{Parameters = $Parameters } $script:AllowNtlmV2 = -not $Parameters.ContainsKey('BlockNTLM') - Mock Get-Command { $script:MappingCommand } -ParameterFilter { $Name -eq 'New-SmbMapping' } + Mock Get-Command { + if ($Name -eq 'New-SmbMapping') { + $script:MappingCommand + } + elseif ($Name -eq 'Get-SmbConnection') { + [pscustomobject]@{ Name = 'Get-SmbConnection'; Parameters = @{} } + } + else { + $null + } + } + Mock Get-SmbConnection { $script:Connection } Mock Get-ItemProperty { [pscustomobject]@{LmCompatibilityLevel = 5 } } -ParameterFilter { $Name -eq 'LmCompatibilityLevel' } Mock Test-TcpPort { $true } Mock Get-SmbMapping { @() } diff --git a/build/Invoke-Validation.ps1 b/build/Invoke-Validation.ps1 index 70385bc..3dd9df7 100644 --- a/build/Invoke-Validation.ps1 +++ b/build/Invoke-Validation.ps1 @@ -24,7 +24,7 @@ try { throw 'Validation requires Windows PowerShell 5.1 (powershell.exe).' } - Import-Module Pester -RequiredVersion 5.7.1 -ErrorAction Stop + Import-Module Pester -RequiredVersion 6.2.0 -ErrorAction Stop Import-Module PSScriptAnalyzer -RequiredVersion 1.25.0 -ErrorAction Stop $Root = Split-Path -Parent $PSScriptRoot $Files = @(Get-ChildItem -LiteralPath $Root -Force | Where-Object { $_.Name -ne '.git' } | diff --git a/docs/release-process.md b/docs/release-process.md index 5820b9d..8fd5473 100644 --- a/docs/release-process.md +++ b/docs/release-process.md @@ -12,7 +12,7 @@ Publish **v1.0.0** as a prerelease candidate. Verify its downloaded assets, then 1. Keep `VERSION`, both production-script version literals, badges, examples, and the current changelog aligned to the intended three-part numeric version. 2. Add a nonempty `## v1.0.0` section to `RELEASE-NOTES.md` for this release. The workflow selects the exact tag's section. For a later version, replace the numeric version everywhere it identifies current release content. -3. Use Windows PowerShell 5.1 with pinned Pester 5.7.1 and PSScriptAnalyzer 1.25.0 modules from an approved source; do not bypass publisher verification. See [validation prerequisites](validation.md#prerequisites-and-scope). +3. Use Windows PowerShell 5.1 with pinned Pester 6.2.0 and PSScriptAnalyzer 1.25.0 modules from an approved source; do not bypass publisher verification. Pester 6.2.0 supports Windows PowerShell 5.1; follow its official v5-to-v6 migration guidance when changing test behavior. See [validation prerequisites](validation.md#prerequisites-and-scope). 4. Finish all changes, normalize maintained text to the [checkout convention](#checksum-checkout-convention), and regenerate `CHECKSUMS.txt` **last**. 5. Run the full validator with `-Tag v1.0.0` and without `-SkipChecksums`. This verifies version agreement without creating a tag. 6. Before publication, validate the exact committed revision, a fresh checkout, and the **extracted release ZIP**. The existing `git archive` flow honors this repository's `.gitattributes`. Check the produced file bytes against the manifest rather than inferring them from Git's stored blobs. diff --git a/docs/validation.md b/docs/validation.md index f7e3a0b..a5ae907 100644 --- a/docs/validation.md +++ b/docs/validation.md @@ -14,7 +14,7 @@ The automated suite checks source integrity and isolated behavior. ConfigMgr, Wi ## Prerequisites and scope -Use the same pinned development modules as CI: Pester 5.7.1 and PSScriptAnalyzer 1.25.0. The validator explicitly requires Windows PowerShell 5.1 and those exact module versions. +Use the same pinned development modules as CI: Pester 6.2.0 and PSScriptAnalyzer 1.25.0. Pester 6.2.0 supports Windows PowerShell 5.1; its v5-to-v6 migration guidance requires default mocks for filtered mocks that must also handle unmatched calls. The validator explicitly requires Windows PowerShell 5.1 and those exact module versions. Use an approved package source and trust policy; do not bypass publisher verification. It analyzes `Scripts`, `Tests`, and `build`, checks `VERSION` against the production script's literal version assignment, and verifies `CHECKSUMS.txt`. Parser errors, analyzer warnings/errors, missing modules, failed, skipped, or not-run Pester tests, failed discovery, zero discovered tests, and manifest/version errors return a nonzero process exit. @@ -22,7 +22,7 @@ Parser errors, analyzer warnings/errors, missing modules, failed, skipped, or no If the modules are missing, install them from your approved source and trust policy: ```powershell -Install-Module Pester -RequiredVersion '5.7.1' -Repository PSGallery -Scope CurrentUser -Force +Install-Module Pester -RequiredVersion '6.2.0' -Repository PSGallery -Scope CurrentUser -Force Install-Module PSScriptAnalyzer -RequiredVersion '1.25.0' -Repository PSGallery -Scope CurrentUser -Force ```