correctly delete $profile in all cases
This commit is contained in:
parent
0c1274011c
commit
3b5663ee97
1 changed files with 3 additions and 1 deletions
|
@ -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 {
|
||||||
if (Test-Path "$profile.backup") {
|
|
||||||
Remove-Item -Path $profile -ErrorAction SilentlyContinue
|
Remove-Item -Path $profile -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
if (Test-Path "$profile.backup") {
|
||||||
Rename-Item -Path "$profile.backup" -NewName $profile
|
Rename-Item -Path "$profile.backup" -NewName $profile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue