Skip to content

Commit ac53bc3

Browse files
committed
fix(tests): 🐛 Simplify output path handling in build.tests.ps1
* Removed conditional logic for setting `$script:testModuleOutputPath`. * Ensured output path is consistently set relative to the test module source. * Updated `Start-Job` script block declaration for consistency.
1 parent 7f077f5 commit ac53bc3

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

tests/build.tests.ps1

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,7 @@ Describe 'Build' {
2525
$script:testModuleSource = Join-Path $TestDrive 'TestModule'
2626
Copy-Item $PSScriptRoot/fixtures/TestModule $script:testModuleSource -Recurse
2727
Set-Location $script:testModuleSource
28-
# Hack for GH Actions
29-
# For some reason, the TestModule build process create the output in the project root
30-
# and not relative to it's own build file.
31-
if ($env:GITHUB_ACTION) {
32-
$script:testModuleOutputPath = [IO.Path]::Combine($env:BHProjectPath, 'Output', 'TestModule', '0.1.0')
33-
} else {
34-
$script:testModuleOutputPath = [IO.Path]::Combine($script:testModuleSource, 'Output', 'TestModule', '0.1.0')
35-
}
28+
$script:testModuleOutputPath = [IO.Path]::Combine($script:testModuleSource, 'Output', 'TestModule', '0.1.0')
3629

3730
# Capture any of the jobs for cleanup later
3831
[array]$script:jobs = @()
@@ -48,7 +41,7 @@ Describe 'Build' {
4841
Write-Host "OutputPath: $script:testModuleOutputPath"
4942

5043
# build is PS job so psake doesn't freak out because it's nested
51-
$script:jobs += Start-Job -Scriptblock {
44+
$script:jobs += Start-Job -ScriptBlock {
5245
param($testModuleSource, $outputModVerManifest)
5346
Set-Location -Path $using:testModuleSource
5447
# We want to load the current build of PowerShellBuild so we use a
@@ -112,7 +105,7 @@ Describe 'Build' {
112105
# Overwrite the existing PSM1 with the dot-sourced version
113106
Copy-Item @copyItemSplat
114107
# build is PS job so psake doesn't freak out because it's nested
115-
$script:jobs += Start-Job -Scriptblock {
108+
$script:jobs += Start-Job -ScriptBlock {
116109
param($testModuleSource, $outputModVerManifest)
117110
Set-Location -Path $testModuleSource
118111
# We want to load the current build of PowerShellBuild so we use a
@@ -163,7 +156,7 @@ Describe 'Build' {
163156
# Overwrite the existing PSM1 with the dot-sourced version
164157
Copy-Item @copyItemSplat
165158
# Build once, and then we'll modify
166-
$script:jobs += Start-Job -Scriptblock {
159+
$script:jobs += Start-Job -ScriptBlock {
167160
param($testModuleSource, $outputModVerManifest)
168161
Set-Location -Path $using:testModuleSource
169162
# We want to load the current build of PowerShellBuild so we use a
@@ -186,7 +179,7 @@ Describe 'Build' {
186179
Set-Content $psakeFile -Value $psakeFileContent -Force
187180

188181
# build is PS job so psake doesn't freak out because it's nested
189-
$script:jobs += Start-Job -Scriptblock {
182+
$script:jobs += Start-Job -ScriptBlock {
190183
param($testModuleSource, $outputModVerManifest)
191184
Set-Location -Path $using:testModuleSource
192185
# We want to load the current build of PowerShellBuild so we use a

0 commit comments

Comments
 (0)