Skip to content

Commit e445d7f

Browse files
tablackburnclaude
andcommitted
fix(build): guard coverage env vars and normalize path style
Address PR #19 review feedback: - Guard against missing $Env:BHPSModuleManifest / $Env:BHProjectName so bypassing build.ps1 (and Set-BuildEnvironment) fails fast with an actionable message instead of an obscure Import-PowerShellDataFile null-binding error. (Copilot review) - Switch the staged-output assembly from Join-Path with embedded forward slashes to [IO.Path]::Combine to match the rest of the properties block and avoid mixed separators on Windows. (CodeRabbit review) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f501644 commit e445d7f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

build.psake.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ properties {
1919
# against those paths. $Env:BHBuildOutput points at <root>/BuildOutput at
2020
# properties-evaluation time (PowerShellBuild rewrites it later inside its
2121
# tasks), so we compute the staged path from the manifest version here.
22+
if (-not $Env:BHPSModuleManifest -or -not $Env:BHProjectName) {
23+
throw 'Coverage configuration requires BuildHelpers env vars. Run via ./build.ps1 or call Set-BuildEnvironment first.'
24+
}
2225
$_moduleVersion = (Import-PowerShellDataFile -Path $Env:BHPSModuleManifest).ModuleVersion
23-
$_stagedOutput = Join-Path $PSScriptRoot "Output/$Env:BHProjectName/$_moduleVersion"
26+
$_stagedOutput = [IO.Path]::Combine($PSScriptRoot, 'Output', $Env:BHProjectName, $_moduleVersion)
2427
$PSBPreference.Test.CodeCoverage.Files = @(
2528
"$_stagedOutput/Public/*.ps1"
2629
"$_stagedOutput/Private/*.ps1"

0 commit comments

Comments
 (0)