mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Enable Experimental Features by default on Preview builds (#10228)
This commit is contained in:
@@ -36,10 +36,6 @@ Describe "Experimental Feature Basic Tests - Feature-Disabled" -tags "CI" {
|
||||
}
|
||||
}
|
||||
|
||||
It "No experimental feature is enabled" {
|
||||
$EnabledExperimentalFeatures.Count | Should -Be 0
|
||||
}
|
||||
|
||||
It "Replace existing command <Name> - version one should be shown" -TestCases @(
|
||||
@{ Name = "Invoke-AzureFunction"; CommandType = "Function" }
|
||||
@{ Name = "Invoke-AzureFunctionCSharp"; CommandType = "Cmdlet" }
|
||||
|
||||
@@ -129,3 +129,51 @@ Describe "Get-ExperimentalFeature Tests" -tags "Feature","RequireAdminOnWindows"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Default enablement of Experimental Features" -Tags CI {
|
||||
BeforeAll {
|
||||
$isPreview = $PSVersionTable.GitCommitId.Contains("preview")
|
||||
|
||||
Function BeEnabled {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
$ActualValue,
|
||||
$Name,
|
||||
[switch]$Negate
|
||||
)
|
||||
|
||||
$failure = if ($Negate) {
|
||||
"Expected: Feature $Name to not be Enabled"
|
||||
}
|
||||
else {
|
||||
"Expected: Feature $Name to be Enabled"
|
||||
}
|
||||
|
||||
return [PSCustomObject]@{
|
||||
Succeeded = if ($Negate) {
|
||||
$ActualValue -eq $false
|
||||
}
|
||||
else {
|
||||
$ActualValue -eq $true
|
||||
}
|
||||
FailureMessage = $failure
|
||||
}
|
||||
}
|
||||
|
||||
Add-AssertionOperator -Name 'BeEnabled' -Test $Function:BeEnabled
|
||||
}
|
||||
|
||||
It "On stable builds, Experimental Features are not enabled" -Skip:($isPreview) {
|
||||
foreach ($expFeature in Get-ExperimentalFeature) {
|
||||
$expFeature.Enabled | Should -Not -BeEnabled -Name $expFeature.Name
|
||||
}
|
||||
}
|
||||
|
||||
It "On preview builds, Experimental Features are enabled" -Skip:(!$isPreview) {
|
||||
(Join-Path -Path $PSHOME -ChildPath 'powershell.config.json') | Should -Exist
|
||||
|
||||
foreach ($expFeature in Get-ExperimentalFeature) {
|
||||
$expFeature.Enabled | Should -BeEnabled -Name $expFeature.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user