[PR #8276] fix: Add Plugin Mocks to Provider Tests #12686

Closed
opened 2026-02-16 18:17:34 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8276

State: closed
Merged: Yes


Summary

Adds missing plugin mocks to provider.test.ts to prevent test timeouts. After moving GitLab auth plugin to the BUILTIN array, all provider tests need to mock builtin plugins to prevent actual package installation attempts during test runs.

Problem

The test "provider loaded from env variable" was timing out (5000ms) because:

  • GitLab auth plugin (@gitlab/opencode-gitlab-auth@1.3.0) is now in the BUILTIN array
  • Plugin loading triggers BunProc.install() for all builtin plugins
  • provider.test.ts had no mocks for BunProc or builtin plugins
  • Real installation attempts caused test timeouts

Solution

Added comprehensive mocks to provider.test.ts:

  • Mock BunProc.install() to return package names without attempting real installations
  • Mock all builtin plugins: opencode-copilot-auth, opencode-anthropic-auth, @gitlab/opencode-gitlab-auth
  • Follow the same mocking pattern used in gitlab-duo.test.ts and amazon-bedrock.test.ts
  • Remove unused imports, fix formatting
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8276 **State:** closed **Merged:** Yes --- ## Summary Adds missing plugin mocks to provider.test.ts to prevent test timeouts. After moving GitLab auth plugin to the BUILTIN array, all provider tests need to mock builtin plugins to prevent actual package installation attempts during test runs. ## Problem The test "provider loaded from env variable" was timing out (5000ms) because: - GitLab auth plugin (@gitlab/opencode-gitlab-auth@1.3.0) is now in the BUILTIN array - Plugin loading triggers BunProc.install() for all builtin plugins - provider.test.ts had no mocks for BunProc or builtin plugins - Real installation attempts caused test timeouts ## Solution Added comprehensive mocks to provider.test.ts: - Mock BunProc.install() to return package names without attempting real installations - Mock all builtin plugins: opencode-copilot-auth, opencode-anthropic-auth, @gitlab/opencode-gitlab-auth - Follow the same mocking pattern used in gitlab-duo.test.ts and amazon-bedrock.test.ts - Remove unused imports, fix formatting
yindo added the pull-request label 2026-02-16 18:17:34 -05:00
yindo closed this issue 2026-02-16 18:17:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12686