Skip to content

fix(test): eliminate all console noise from jest CI logs at the source#3822

Merged
grimen merged 1 commit into
mainfrom
fix/ci-test-log-noise-mocks
Jun 3, 2026
Merged

fix(test): eliminate all console noise from jest CI logs at the source#3822
grimen merged 1 commit into
mainfrom
fix/ci-test-log-noise-mocks

Conversation

@grimen

@grimen grimen commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Second PR for #3813 (follow-up to #3816, which handled the InteractionManager warning that issue was filed for). Jest output is now completely free of console log/debug/warn/error blocks — every source was root-fixed rather than suppressed.

Metric (CI=true, full suite) Before After
Test suites / tests 401 / 4526 ✅ 401 / 4526 ✅
console.warn (incl. 260+ Apollo "No more mocked responses") 260+ 0
console.error 82 0
console.log / console.debug ~8 0
"Maximum update depth exceeded" 4 0
● Console blocks in jest output many 0

Changes

Shared Apollo mocks (app/graphql/mocks.ts)

  • All mocks reusable via maxUsageCount: Infinity (replaces the [...mocks ×6] spread hack) — components fire the same queries on every mount/re-render/refetch
  • Added missing mocks: scanningQRCodeScreen, contacts, supportedCountries, SettingsScreen, walletOverviewScreen, Bulletins, language, notificationSettings, sendBitcoinWithdrawalLimits, realtimePriceUnauthed
  • Backfilled fields the queries select but the aging mock data lacked (me.email, pendingIncomingTransactions, preImage ×20, paymentRequest ×7) — fixes Apollo "Missing field" invariant errors
  • Extracted mockCurrencyList as a shared export for consistent Query.currencyList writes

"No more mocked responses" (260+ → 0, no suppression)

  • home.spec / transaction-history-screen.spec: their @app/graphql/mocks module replacement now backfills with the actual shared mocks (local mocks first + infinite-use, so they keep precedence)
  • send-bitcoin-completed-screen.stories: pass shared mocks instead of [] (matches the other stories files)
  • use-show-warning-secure-account.spec: reusable local mocks + missing displayCurrency mock

"Maximum update depth exceeded" (4 → 0) — test-fixture identity bugs, app code is sound

  • use-payment-request.spec: mutation hook mocks returned a fresh jest.fn() per render → invalidated the mutations memo → useInvoiceLifecycle's layout effect looped. Stable fns now
  • use-invoice-lifecycle.spec: inline prcd object literals changed identity every render, ping-ponging the layout effect against the hash-paid effect. Hoisted to a stable const
  • Unmasked async generateRequest updates settled with flushEffects() (fix(test): wrap async provider/hook updates in act() to clear CI log noise #3820 pattern)

Expected error/log output: captured + asserted instead of printed

A logged-but-expected error is indistinguishable from a real failure in CI logs, so tests exercising error paths now spy on console.error/debug and assert the expected message (the log becomes a test assertion):

  • use-kyc-flow.spec, use-lnurl-withdraw.spec, network-error-component.spec
  • receive.spec: decodeInvoiceString mocked to return no expiry instead of throwing on the intentionally fake invoice fixtures (27 bolt11 "Invalid checksum" errors); nfc-manager mock extended since ModalNfc's init path now actually runs
  • File-scoped console.log spies for app placeholder logs (lazy-locale-loader.test, card-status-screen.spec, card-subscription-screen.spec, receive.spec)

CI-only suppression (jest.setup.js)

Gains only the SafeAreaView deprecation warning (react-native-country-picker-modal), alongside the existing InteractionManager one. The Apollo MockLink warning is not suppressed — it stays as a live signal for future mock gaps.

Latent spec bugs surfaced and fixed

  • Missing feeReimbursementMemo in home.spec's remote-config mock (crashed use-transaction-seen-state once transactions resolved)
  • Missing homeAuthed user fields (language/username/phone/email) in home.spec mock data

Verification

CI=true LOGLEVEL=warn jest --runInBand --forceExit
Test Suites: 401 passed, 401 total
Tests:       4526 passed, 4526 total
console.log/debug/info/warn/error: 0 each; zero "● Console" blocks

Note: for the CI=true gate (and #3816's) to be active on Concourse, the pipeline needs a ci/repipe since CI: true was added to ci/pipeline.yml in #3816.

🤖 Generated with Claude Code

Follow-up to #3816. Jest output is now completely free of console
log/debug/warn/error blocks; every source was root-fixed rather than
suppressed (full suite: 401 suites / 4526 tests passing).

Shared Apollo mocks (app/graphql/mocks.ts):
- All mocks are reusable via maxUsageCount: Infinity (replaces the
  [...mocks x6] spread hack): components fire the same queries on every
  mount, re-render and refetch.
- Add missing mocks: scanningQRCodeScreen, contacts, supportedCountries,
  SettingsScreen, walletOverviewScreen, Bulletins, language,
  notificationSettings, sendBitcoinWithdrawalLimits, realtimePriceUnauthed.
- Backfill fields the queries select but the aging mock data lacked
  (me.email, pendingIncomingTransactions, preImage, paymentRequest),
  fixing Apollo "Missing field" invariant errors on cache writes.
- Extract mockCurrencyList as a shared export so specs and mocks write a
  consistent Query.currencyList (avoids cache-replacement warnings).

"No more mocked responses" (260+ -> 0, no suppression):
- home.spec / transaction-history-screen.spec: the @app/graphql/mocks
  module replacement now backfills with the actual shared mocks (local
  mocks first and infinite-use, so they keep precedence).
- send-bitcoin-completed-screen.stories: pass shared mocks to the
  stories' MockedProviders instead of [].
- use-show-warning-secure-account.spec: reusable local mocks + missing
  displayCurrency mock.

"Maximum update depth exceeded" (4 -> 0):
- use-payment-request.spec: mutation hook mocks returned a fresh
  jest.fn() per render, invalidating the mutations memo and re-running
  useInvoiceLifecycle's layout effect every render. Stable fns now.
- use-invoice-lifecycle.spec: inline prcd object literals changed
  identity every render, ping-ponging the layout effect against the
  hash-paid effect. Hoisted to a stable const.
- The unmasked async generateRequest updates are settled with
  flushEffects() (pattern from #3820).

Expected error/log output is now captured and asserted instead of
printed (a logged-but-expected error is indistinguishable from a real
failure in CI logs):
- use-kyc-flow.spec, use-lnurl-withdraw.spec,
  network-error-component.spec: console.error/debug spies with
  assertions on the expected message.
- receive.spec: decodeInvoiceString mocked to return no expiry instead
  of throwing on the intentionally fake invoice fixtures (27 bolt11
  "Invalid checksum" errors); nfc-manager mock extended with
  requestTechnology/getTag/cancelTechnologyRequest since ModalNfc's init
  path now runs.
- lazy-locale-loader.test, card-status-screen.spec,
  card-subscription-screen.spec, receive.spec: console.log spies for
  app placeholder/diagnostic logs.

jest.setup.js CI suppression gains only the SafeAreaView deprecation
warning (react-native-country-picker-modal), alongside the existing
InteractionManager one.

Also fixes latent spec bugs surfaced by the now-resolving queries:
missing feeReimbursementMemo in home.spec's remote-config mock and
missing homeAuthed user fields (language/username/phone/email).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@grimen grimen merged commit 4fa04eb into main Jun 3, 2026
6 of 8 checks passed
@grimen grimen deleted the fix/ci-test-log-noise-mocks branch June 3, 2026 23:06
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.

fix(test): Deprecation warning floods Concourse/CI logs with gibberish: InteractionManager (via @react-navigation/stack)

2 participants