Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ own `CHANGELOG.md` (generated from `CHANGELOG.template.md` during init).

- "Repository secrets" section in `README.md` documenting the GitHub Actions secrets the bundled workflows expect (`PSGALLERY_API_KEY`, `CODECOV_TOKEN`, `GITGUARDIAN_API_KEY`) — required vs. optional, source, and failure mode when missing.
- `Initialize-Template.ps1` now mentions configuring GitHub repository secrets in its post-init "Next steps" output, between the build-test step and the first push.
- `tests/Help.tests.ps1` can now run standalone — e.g. `Invoke-Pester tests/Help.tests.ps1` directly from an editor (or an agent running a single test) — without first running `./build.ps1`. Its build-bootstrap guard (in both `BeforeDiscovery` and `BeforeAll`) now delegates to `build.ps1 -Task 'Build' -Bootstrap`, the canonical entry point, so dependency bootstrap, BuildHelpers environment setup, and module staging all happen through the real build path instead of a partial reimplementation. The guard only fires when `BHBuildOutput` is unset, so there is no effect on CI or `./build.ps1` runs. `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.

### Changed

Expand Down
30 changes: 18 additions & 12 deletions tests/Help.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@ BeforeDiscovery {
# Check if the BHBuildOutput environment variable exists to determine if this test is running in a psake
# build or not. If it does not exist, it is not running in a psake build, so build the module.
if ($null -eq $Env:BHBuildOutput) {
$buildFilePath = Join-Path -Path $PSScriptRoot -ChildPath '..\build.psake.ps1'
$invokePsakeParameters = @{
TaskList = 'Build'
BuildFile = $buildFilePath
}
Invoke-psake @invokePsakeParameters
# Standalone run (e.g. Invoke-Pester on this file directly, or an agent
# running one test): the module isn't built and the BuildHelpers env vars
# aren't set. Defer to build.ps1 -- the canonical entry point -- to bootstrap
# dependencies, set the BuildHelpers environment, and stage the module.
# Invoke with & (not dot-sourcing): build.ps1 ends in an exit statement, and
# the call operator contains it to the script boundary instead of ending the
# whole Pester run.
$buildScript = Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath 'build.ps1'
& $buildScript -Task 'Build' -Bootstrap
}

# PowerShellBuild outputs to Output/<ModuleName>/<Version>/, override BHBuildOutput
Expand Down Expand Up @@ -99,12 +102,15 @@ BeforeAll {
# Check if the BHBuildOutput environment variable exists to determine if this test is running in a psake
# build or not. If it does not exist, it is not running in a psake build, so build the module.
if ($null -eq $Env:BHBuildOutput) {
$buildFilePath = Join-Path -Path $PSScriptRoot -ChildPath '..\build.psake.ps1'
$invokePsakeParameters = @{
TaskList = 'Build'
BuildFile = $buildFilePath
}
Invoke-psake @invokePsakeParameters
# Standalone run (e.g. Invoke-Pester on this file directly, or an agent
# running one test): the module isn't built and the BuildHelpers env vars
# aren't set. Defer to build.ps1 -- the canonical entry point -- to bootstrap
# dependencies, set the BuildHelpers environment, and stage the module.
# Invoke with & (not dot-sourcing): build.ps1 ends in an exit statement, and
# the call operator contains it to the script boundary instead of ending the
# whole Pester run.
$buildScript = Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath 'build.ps1'
& $buildScript -Task 'Build' -Bootstrap
}
}

Expand Down
Loading