Skip to content

Fix broken @stellar/stellar-sdk vitest mock — makes every PR look red #146

Description

@Miracle656

Problem

Typecheck & build fails on main with:

Error: [vitest] No "Networks" export is defined on the "@stellar/stellar-sdk" mock.
       Did you forget to return it from "vi.mock"?

Confirmed pre-existing rather than inferred: it fails identically on #137, which adds a single .md file and no code. A markdown-only PR cannot break a typecheck, so the failure is on main.

Why this matters more than one red check

Every open PR in the current batch shows a red Typecheck & build. Contributors can't tell whether they broke something, and reviewers start waving red checks through — which is exactly how a real failure eventually gets merged. A permanently-red required check is worse than no check, because it trains everyone to ignore the signal.

What to do

A vi.mock('@stellar/stellar-sdk', …) factory somewhere in the test suite returns a partial module that omits the Networks export, while some code path under test reads Networks.PUBLIC / Networks.TESTNET.

  1. Find the offending vi.mock factory.
  2. Prefer spreading the real module over hand-listing exports, so future additions don't break it again:
    vi.mock('@stellar/stellar-sdk', async (importOriginal) => ({
      ...(await importOriginal<typeof import('@stellar/stellar-sdk')>()),
      // ...only the specific overrides this test needs
    }))
    Hand-maintained partial mocks of a large SDK re-break on every upgrade; importOriginal doesn't.
  3. Confirm npm test is green on a clean main before closing.

Acceptance criteria

  • npm test passes on main with no @stellar/stellar-sdk mock errors
  • Typecheck & build is green on a freshly-opened PR
  • Any remaining partial mocks of @stellar/stellar-sdk use importOriginal spreading rather than a hand-listed export set

Drips Wave · Complexity: Easy · 100 points

Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave program

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions