(t *testing.T)
| 592 | } |
| 593 | |
| 594 | func TestRunCopilot_execFailureHint(t *testing.T) { |
| 595 | ios, _, _, _ := iostreams.Test() |
| 596 | opts := &CopilotOptions{ |
| 597 | IO: ios, |
| 598 | CopilotArgs: []string{}, |
| 599 | } |
| 600 | |
| 601 | origFind := findCopilotBinaryFunc |
| 602 | findCopilotBinaryFunc = func() string { |
| 603 | return "/usr/bin/copilot" |
| 604 | } |
| 605 | t.Cleanup(func() { findCopilotBinaryFunc = origFind }) |
| 606 | |
| 607 | execErr := fmt.Errorf("exec failed: something went wrong") |
| 608 | origRun := runExternalCmdFunc |
| 609 | runExternalCmdFunc = func(_ *exec.Cmd) error { |
| 610 | return execErr |
| 611 | } |
| 612 | t.Cleanup(func() { runExternalCmdFunc = origRun }) |
| 613 | |
| 614 | err := runCopilot(opts) |
| 615 | require.Error(t, err) |
| 616 | require.ErrorIs(t, err, execErr) |
| 617 | require.Contains(t, err.Error(), "try running `copilot` directly without `gh`.") |
| 618 | } |
| 619 | |
| 620 | func TestCopilotCommandIsSampledAt100(t *testing.T) { |
| 621 | spy := &telemetry.CommandRecorderSpy{} |
nothing calls this directly
no test coverage detected