From 7dac194a54ee4276380acaf9670a86af4cb63509 Mon Sep 17 00:00:00 2001 From: James Truher Date: Fri, 12 May 2023 14:34:33 -0700 Subject: [PATCH 1/2] Change how isPreview is determined. In release builds, we will don't always label the build as preview, sometimes it's daily. However, if we can't convert the (string) psversion to a System.Version we know we have a preview. --- test/powershell/engine/Basic/DefaultCommands.Tests.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 b/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 index 065f960b0e0..b6fb3aea968 100644 --- a/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 +++ b/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 @@ -18,7 +18,8 @@ Describe "Verify aliases and cmdlets" -Tags "CI" { $FullCLR = !$IsCoreCLR $CoreWindows = $IsCoreCLR -and $IsWindows $CoreUnix = $IsCoreCLR -and !$IsWindows - $isPreview = $PSVersionTable.GitCommitId.Contains("preview") + # if psversion can be converted to [version], then it is not a preview version + $isPreview = $psversiontable.psversion.tostring() -as [version] ? $false : $true if ($IsWindows) { $configPath = Join-Path -Path $env:USERPROFILE -ChildPath 'Documents' -AdditionalChildPath 'PowerShell' } From 2cbf4db2aa9de8fd88c7c13e1dd4fd9e79205b37 Mon Sep 17 00:00:00 2001 From: James Truher Date: Sat, 13 May 2023 09:43:07 -0700 Subject: [PATCH 2/2] Handle RC releases as non-preview. --- test/powershell/engine/Basic/DefaultCommands.Tests.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 b/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 index b6fb3aea968..6744bf0295c 100644 --- a/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 +++ b/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 @@ -18,8 +18,12 @@ Describe "Verify aliases and cmdlets" -Tags "CI" { $FullCLR = !$IsCoreCLR $CoreWindows = $IsCoreCLR -and $IsWindows $CoreUnix = $IsCoreCLR -and !$IsWindows - # if psversion can be converted to [version], then it is not a preview version - $isPreview = $psversiontable.psversion.tostring() -as [version] ? $false : $true + # If psversion can be converted to [version], then it is not a preview version. + # We can't just use '$psversiontable.psversion -as [version]' because pwsh + # will succeed with the conversion and add note properties to the version object. + $psVersionAsVersion = $psversiontable.psversion.tostring() -as [version] + $isRC = $psversiontable.psversion.tostring() -match "rc" + $isPreview = -not ($isRC -or $psVersionAsVersion) if ($IsWindows) { $configPath = Join-Path -Path $env:USERPROFILE -ChildPath 'Documents' -AdditionalChildPath 'PowerShell' }