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 @@ -46,12 +46,12 @@ protected override void EndProcessing()
string.Format(
System.Globalization.CultureInfo.InvariantCulture,
CommandBaseStrings.NativeCommandNotFound,
command
WithCommand[0]
)
),
"CommandNotFound",
ErrorCategory.InvalidArgument,
WithCommand
WithCommand[0]
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' {
Expand Down
2 changes: 1 addition & 1 deletion test/xUnit/csharp/test_Feedback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public string GetFeedback(string commandLine, ErrorRecord errorRecord, Cancellat
{
// The delay is exaggerated to make the test reliable.
// xUnit must spin up a lot tasks, which makes the test unreliable when the time difference between 'delay' and 'timeout' is small.
Thread.Sleep(2000);
Thread.Sleep(2500);
}

return $"{commandLine}+{errorRecord.FullyQualifiedErrorId}";
Expand Down