Skip to content

Commit aa6283d

Browse files
tablackburnclaude
andcommitted
fix(tests): remove PS6+ Start-Job -WorkingDirectory for 5.1 compat
The build.tests.ps1 Compile/Dot-sourced contexts started Wait-Job builds with Start-Job -WorkingDirectory, a parameter introduced in PowerShell 6.0 that does not exist on Windows PowerShell 5.1. Under the shared workflow's full 5.1 test run this threw ParameterBindingException, the TestModule never built, and all 15 downstream assertions failed. The scriptblock already Set-Location's to the test module source, so -WorkingDirectory was redundant; removing it is behavior-identical on pwsh and 5.1-safe. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent d552429 commit aa6283d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tests/build.tests.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ Describe 'Build' {
2121
Write-Host "OutputPath: $script:testModuleOutputPath"
2222

2323
# build is PS job so psake doesn't freak out because it's nested
24+
# NOTE: the scriptblock Set-Location handles the working directory;
25+
# Start-Job -WorkingDirectory is PS 6+ only and breaks on Windows PowerShell 5.1.
2426
Start-Job -Scriptblock {
2527
Set-Location -Path $using:testModuleSource
2628
$global:PSBuildCompile = $true
2729
./build.ps1 -Task Build
28-
} -WorkingDirectory $script:testModuleSource | Wait-Job
30+
} | Wait-Job
2931
}
3032

3133
AfterAll {
@@ -73,11 +75,13 @@ Describe 'Build' {
7375
Context 'Dot-sourced module' {
7476
BeforeAll {
7577
# build is PS job so psake doesn't freak out because it's nested
78+
# NOTE: the scriptblock Set-Location handles the working directory;
79+
# Start-Job -WorkingDirectory is PS 6+ only and breaks on Windows PowerShell 5.1.
7680
Start-Job -Scriptblock {
7781
Set-Location -Path $using:testModuleSource
7882
$global:PSBuildCompile = $false
7983
./build.ps1 -Task Build
80-
} -WorkingDirectory $script:testModuleSource | Wait-Job
84+
} | Wait-Job
8185
Write-Debug "TestModule output path: $script:testModuleSource"
8286
$items = Get-ChildItem -Path $script:testModuleSource -Recurse -File
8387
Write-Debug ($items | Format-Table FullName | Out-String)

0 commit comments

Comments
 (0)