From 09ee9571c8bca94872f7bee83fb43b412f573908 Mon Sep 17 00:00:00 2001 From: Garry Hughes Date: Thu, 1 Feb 2024 10:53:34 +1100 Subject: [PATCH] fix to help tests for powershell 74 --- Stucco/template/tests/Help.tests.ps1 | 6 +----- tests/Help.tests.ps1 | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Stucco/template/tests/Help.tests.ps1 b/Stucco/template/tests/Help.tests.ps1 index e36a133..699b5fa 100644 --- a/Stucco/template/tests/Help.tests.ps1 +++ b/Stucco/template/tests/Help.tests.ps1 @@ -4,11 +4,7 @@ BeforeDiscovery { function global:FilterOutCommonParams { param ($Params) - $commonParams = @( - 'Debug', 'ErrorAction', 'ErrorVariable', 'InformationAction', 'InformationVariable', - 'OutBuffer', 'OutVariable', 'PipelineVariable', 'Verbose', 'WarningAction', - 'WarningVariable', 'Confirm', 'Whatif' - ) + $commonParams = [System.Management.Automation.PSCmdlet]::OptionalCommonParameters + [System.Management.Automation.PSCmdlet]::CommonParameters $params | Where-Object { $_.Name -notin $commonParams } | Sort-Object -Property Name -Unique } diff --git a/tests/Help.tests.ps1 b/tests/Help.tests.ps1 index e36a133..699b5fa 100644 --- a/tests/Help.tests.ps1 +++ b/tests/Help.tests.ps1 @@ -4,11 +4,7 @@ BeforeDiscovery { function global:FilterOutCommonParams { param ($Params) - $commonParams = @( - 'Debug', 'ErrorAction', 'ErrorVariable', 'InformationAction', 'InformationVariable', - 'OutBuffer', 'OutVariable', 'PipelineVariable', 'Verbose', 'WarningAction', - 'WarningVariable', 'Confirm', 'Whatif' - ) + $commonParams = [System.Management.Automation.PSCmdlet]::OptionalCommonParameters + [System.Management.Automation.PSCmdlet]::CommonParameters $params | Where-Object { $_.Name -notin $commonParams } | Sort-Object -Property Name -Unique }