correctly delete $profile in all cases

This commit is contained in:
Steve Lee 2019-05-04 07:12:53 -07:00
parent 0c1274011c
commit 3b5663ee97

View file

@ -251,12 +251,14 @@ Describe "ConsoleHost unit tests" -tags "Feature" {
Remove-Item -Path "$profile.backup" -ErrorAction SilentlyContinue Remove-Item -Path "$profile.backup" -ErrorAction SilentlyContinue
Rename-Item -Path $profile -NewName "$profile.backup" Rename-Item -Path $profile -NewName "$profile.backup"
} }
Set-Content -Path $profile -Value "'profile-loaded'" -Force Set-Content -Path $profile -Value "'profile-loaded'" -Force
} }
AfterAll { AfterAll {
Remove-Item -Path $profile -ErrorAction SilentlyContinue
if (Test-Path "$profile.backup") { if (Test-Path "$profile.backup") {
Remove-Item -Path $profile -ErrorAction SilentlyContinue
Rename-Item -Path "$profile.backup" -NewName $profile Rename-Item -Path "$profile.backup" -NewName $profile
} }
} }