From 6fb6efac35545d5b485f37620b555169a8f3561c Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Tue, 10 Nov 2026 20:31:04 -0700 Subject: [PATCH] test-local: use the build's required modules on a clean checkout output/RequiredModules was added to PSModulePath only at the start, before the Build stage creates it. A one-call run on a clean machine (the release workflow) then had no platyPS for the Docs stage. Co-Authored-By: Claude --- Tests/test-local.ps1 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Tests/test-local.ps1 b/Tests/test-local.ps1 index e23be4d..f4136a5 100644 --- a/Tests/test-local.ps1 +++ b/Tests/test-local.ps1 @@ -66,9 +66,12 @@ $Failures = New-Object System.Collections.Generic.List[string] # Restored before the script exits. $SavedModulePath = $env:PSModulePath $RequiredModulesPath = Join-Path $RepoRoot 'output/RequiredModules' -if ((Test-Path $RequiredModulesPath) -and ($env:PSModulePath -notlike "*$RequiredModulesPath*")) { - $env:PSModulePath = $RequiredModulesPath + [IO.Path]::PathSeparator + $env:PSModulePath +function Add-RequiredModulesPath { + if ((Test-Path $RequiredModulesPath) -and ($env:PSModulePath -notlike "*$RequiredModulesPath*")) { + $env:PSModulePath = $RequiredModulesPath + [IO.Path]::PathSeparator + $env:PSModulePath + } } +Add-RequiredModulesPath function Write-Stage([string]$Name) { Write-Host '' @@ -99,6 +102,9 @@ if ($Stage -contains 'Build') { & (Get-Process -Id $PID).Path @BuildArgs if ($LASTEXITCODE -ne 0) { $Failures.Add("Build: build.ps1 exited with $LASTEXITCODE") } $env:ModuleVersion = $SavedBuildVersion + # On a clean checkout the build has only just created output/RequiredModules; the later stages need it + # (the release workflow runs every stage in one call on a runner that has no platyPS). + Add-RequiredModulesPath } }