Commit fc04e67
feat: make Help tests runnable standalone via build.ps1 (#38)
* feat: make Help tests runnable standalone via Set-BuildEnvironment
tests/Help.tests.ps1 bootstraps the build via Invoke-psake when
$Env:BHBuildOutput is unset, but build.psake.ps1's properties block
needs BuildHelpers vars (BHProjectName, BHPSModuleManifest) that are only
populated by ./build.ps1 before psake runs. Running the Help tests in
isolation (e.g. Invoke-Pester tests/Help.tests.ps1 from an editor)
bypasses that, leaving the vars empty and the standalone build broken.
Call Set-BuildEnvironment inside the existing bootstrap guard in both
BeforeDiscovery and BeforeAll so the vars are populated before psake is
invoked. The guard only fires when BHBuildOutput is unset, so there is no
effect when tests run via ./build.ps1 or in CI; Set-BuildEnvironment
-Force is idempotent.
Surfaced by a cross-repo audit against a consumer module
(tablackburn/PlexAutomationToolkit) that already carried this fix locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor(tests): bootstrap standalone Help tests via build.ps1
Replace the inline Set-BuildEnvironment + Invoke-psake bootstrap in
Help.tests.ps1 (both BeforeDiscovery and BeforeAll) with a single call
to build.ps1 -- the canonical entry point -- so dependency bootstrap,
BuildHelpers environment setup, and module staging all run through the
real build path instead of a partial reimplementation that could drift.
build.ps1 is invoked with the call operator (&), not dot-sourced, so its
terminating exit is contained to the script boundary and does not end
the Pester run (verified on Windows PowerShell 5.1 and PowerShell 7).
Path is built with a single two-argument Join-Path over
Split-Path -Parent so it stays valid on PowerShell 5.1 (which lacks
Join-Path -AdditionalChildPath).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 329ca92 commit fc04e67
2 files changed
Lines changed: 19 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
| |||
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
| |||
0 commit comments