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