Skip to content

Conversation

@vglafirov
Copy link
Contributor

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/[email protected]) 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

Simplify GitLab Duo provider implementation following code review:

- Move @gitlab/[email protected] to BUILTIN array (like Copilot/Anthropic)
- Make @gitlab/[email protected] opt-in (not auto-loaded)
- Remove custom GitLab plugin detection logic (~33 lines)
- Simplify auth to use Auth.get() instead of manual parsing (~45 lines)
- Remove unused imports (path, os) from provider.ts
- Add plugin mocks to all provider tests to prevent installation timeouts

Net code reduction: 63 lines
All 660 tests passing
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@vglafirov
Copy link
Contributor Author

@rekram1-node I've introduced some tests degradation recently, after GitLab provider PR has been merged. This fixes the tests.
I also left some unused inports, removing them. Sorry you clicked merge before I realised it 🤦

@rekram1-node rekram1-node merged commit 452f11f into anomalyco:dev Jan 13, 2026
3 checks passed
fwang pushed a commit that referenced this pull request Jan 14, 2026
shuv1337 added a commit to Latitudes-Dev/shuvcode that referenced this pull request Jan 14, 2026
Upstream changes:
- feat: add plan mode with enter/exit tools (anomalyco#8281)
- feat: Add GitLab Duo Agentic Chat Provider Support (anomalyco#7333)
- feat(desktop): Ask Question Tool Support (anomalyco#8232)
- feat: add Undertale and Deltarune built-in themes (anomalyco#8240)
- fix: Add Plugin Mocks to Provider Tests (anomalyco#8276)
- fix: update User-Agent string to latest Chrome version in webfetch (anomalyco#8284)
- fix(prompt-input): handle Shift+Enter before IME check
- fix(state): delete key from recordsByKey on instance disposal
- fix(mcp): close existing client before reassignment to prevent leaks

Resolved conflicts:
- bun.lock: regenerated with fork dependencies
- global-sync.tsx: adopted upstream variable naming (question instead of request)
- session/index.tsx: merged upstream workdir display with fork's ANSI terminal emulation
- amazon-bedrock.test.ts: added all mock modules (fork + upstream)
- vscode/package.json: kept fork branding, updated version

Fork commits included:
- refactor(tui): use SDK client for tool list dialog
- chore: update lockfile with fork dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants