Skip to content

test(ci): isolate sync target guard from real Git queries - #10863

Merged
zkochan merged 1 commit into
teambit:masterfrom
zkochan:fix/ci-sync-guard-test
Oct 26, 2026
Merged

zkochan merged 1 commit into
teambit:masterfrom
zkochan:fix/ci-sync-guard-test

Conversation

@zkochan

@zkochan zkochan commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

The invalid branch-name guard test invoked the shared Git client's real status and remote queries before reaching the guard. On a slow checkout it exceeded Mocha's two-second timeout, failing the CI component's unit suite.

Stub those two queries for this test and restore the shared client in finally. The guard assertion and timeout are unchanged.

Validation:

  • All 405 CI component unit tests pass locally using Mocha and Babel with installed Bit dependencies.
  • With status delayed by 2.5 seconds, the original test reproduces the 2000 ms timeout; the fixed test passes (all seven tests in its file).
  • Prettier and git diff --check pass.
  • CircleCI PR build passes, including all 405 CI component tests (533 ms). CI lint and the full workspace type check pass; all four GitHub E2E shards pass.

Fixes the CircleCI unit-test failure blocking #10813.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Isolate the CI sync target guard test from Git latency

🧪 Tests 🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Stub Git status and remote queries so the invalid-branch guard test cannot time out on slow
 checkouts.
• Restore the shared Git client after the test, including when the assertion fails.
Diagram

graph TD
  T["Guard test"] --> O["Sync orchestrator"] --> G["Stubbed Git queries"]
  O --> R["Invalid lane result"]
  T --> G
  T --> R
Loading
High-Level Assessment

Keep the test-scoped stubs with finally-based restoration. Injecting a Git dependency into production orchestration solely for this test would add unnecessary scope; the existing guard assertion remains intact.

Files changed (1) +14 / -2

Tests (1) +14 / -2
sync-orchestrator.spec.tsStub pre-guard Git queries in the invalid-branch test +14/-2

Stub pre-guard Git queries in the invalid-branch test

• Replaces the shared client's status and remote methods with immediate test responses before invoking sync. Restores both original methods in a finally block, while retaining the existing guard assertion.

scopes/git/ci/sync/sync-orchestrator.spec.ts

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can type 'qodo, fix this' on a finding and the fix lands right on your PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@zkochan
zkochan merged commit 3ab125f into teambit:master Oct 26, 2026
17 checks passed
@zkochan zkochan mentioned this pull request Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant