Skip to content

Commit d16ac61

Browse files
committed
fix(tests): 🐛 Replace Set-Location with Push-Location and Pop-Location
* Ensures proper stack management for directory changes in tests. * Improves cleanup in `AfterAll` by restoring the previous location.
1 parent e57a560 commit d16ac61

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/build.tests.ps1

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Describe 'Build' {
44
BeforeAll {
55
$tempDir = Join-Path $TestDrive 'TestModule'
66
Copy-Item $PSScriptRoot/fixtures/TestModule $tempDir -Recurse
7-
Set-Location $tempDir
7+
Push-Location $tempDir
88

99
# Capture any of the jobs for cleanup later
1010
[array]$script:jobs = @()
@@ -14,6 +14,7 @@ Describe 'Build' {
1414
}
1515

1616
AfterAll {
17+
Pop-Location
1718
$jobs | Stop-Job -ErrorAction Ignore
1819
$jobs | Remove-Job -ErrorAction Ignore
1920
}

0 commit comments

Comments
 (0)