diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index 8187e2e45..4e62fb462 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -269,8 +269,14 @@ Describe "ConsoleHost unit tests" -tags "Feature" { ){ param($switch) - Get-Content $profile -Raw | Should -Not -BeNullOrEmpty - & pwsh $switch -c exit | Should -BeExactly "profile-loaded" + if (Test-Path $profile) { + & pwsh $switch -command exit | Should -BeExactly "profile-loaded" + } + else { + # In CI, may not be able to write to $profile location, so just verify that the switch is accepted + # and no error message is in the output + & pwsh $switch -command exit *>&1 | Should -BeNullOrEmpty + } } }