Skip to content

Commit 4e8a079

Browse files
committed
Emit warning for deprecation of Find-RoleCapability
1 parent a32af99 commit 4e8a079

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Test/FindPSResource.Tests.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ Describe 'Test CompatPowerShellGet: Find-PSResource' -tags 'CI' {
190190
$resModuleType = Out-String -InputObject $resModule.Type
191191
$resModuleType.Replace(",", " ").Split() | Should -Contain "Module"
192192
}
193+
194+
It "Find-RoleCapability should emit warning" {
195+
$results = Find-RoleCapability -Name $testModuleName -Repository $PSGalleryName -WarningVariable wv
196+
$results | Should -BeNullOrEmpty
197+
$wv[0] | Should -Be "The cmdlet 'Find-RoleCapability' is deprecated."
198+
}
193199
}
194200

195201
# Ensure that PSGet v2 was not loaded during the test via command discovery

src/CompatPowerShellGet.psm1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ param(
573573
begin
574574
{
575575
# Find-RoleCability is no longer supported
576+
Write-Warning -Message "The cmdlet 'Find-RoleCapability' is deprecated."
576577
}
577578
<#
578579
.ForwardHelpTargetName Find-RoleCapability

0 commit comments

Comments
 (0)