Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4131,7 +4131,7 @@ .FORWARDHELPCATEGORY Cmdlet
{
$help
}
else
elseif ($help -ne $null)
{
# Respect PAGER, use more on Windows, and use less on Linux
$moreCommand,$moreArgs = $env:PAGER -split '\s+'
Expand Down
11 changes: 11 additions & 0 deletions test/powershell/engine/Help/HelpSystem.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -469,3 +469,14 @@ Describe 'help can be found for AllUsers Scope' -Tags @('Feature', 'RequireAdmin
$helpObj.description | Out-String | Should -Match $CmdletName
}
}

Describe "Help failure cases" -Tags Feature {
It "An error is returned for a topic that doesn't exist: <command>" -TestCases @(
@{ command = "help" },
@{ command = "get-help" }
){
param($command)

{ & $command foobar -ErrorAction Stop } | Should -Throw -ErrorId "HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand"
}
}