mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Fix Switch-Process error to include the command that is not found (#18443)
This commit is contained in:
1 parent
3e1a4d5679
commit
52a62e9ef2
3 files changed
+10
-3
No files matched your search
@@ -48,6 +48,13 @@ Describe 'Switch-Process tests for Unix' -Tags 'CI' {
|
||||
($p | Get-Process).Name -eq 'sleep'
|
||||
} -timeout 60000 -interval 100 | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Error is returned if target command is not found' {
|
||||
$invalidCommand = 'doesNotExist'
|
||||
$e = { Switch-Process $invalidCommand } | Should -Throw -ErrorId 'CommandNotFound,Microsoft.PowerShell.Commands.SwitchProcessCommand' -PassThru
|
||||
$e.Exception.Message | Should -BeLike "*'$invalidCommand'*"
|
||||
$e.TargetObject | Should -BeExactly $invalidCommand
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Switch-Process for Windows' -Tag 'CI' {
|
||||
|
||||
Reference in new issue
Block a user