fix(test): eliminate all console noise from jest CI logs at the source#3822
Merged
Conversation
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>
esaugomez31
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
console.warn(incl. 260+ Apollo "No more mocked responses")console.errorconsole.log/console.debug● Consoleblocks in jest outputChanges
Shared Apollo mocks (
app/graphql/mocks.ts)maxUsageCount: Infinity(replaces the[...mocks ×6]spread hack) — components fire the same queries on every mount/re-render/refetchscanningQRCodeScreen,contacts,supportedCountries,SettingsScreen,walletOverviewScreen,Bulletins,language,notificationSettings,sendBitcoinWithdrawalLimits,realtimePriceUnauthedme.email,pendingIncomingTransactions,preImage×20,paymentRequest×7) — fixes Apollo "Missing field" invariant errorsmockCurrencyListas a shared export for consistentQuery.currencyListwrites"No more mocked responses" (260+ → 0, no suppression)
home.spec/transaction-history-screen.spec: their@app/graphql/mocksmodule 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 + missingdisplayCurrencymock"Maximum update depth exceeded" (4 → 0) — test-fixture identity bugs, app code is sound
use-payment-request.spec: mutation hook mocks returned a freshjest.fn()per render → invalidated themutationsmemo →useInvoiceLifecycle's layout effect looped. Stable fns nowuse-invoice-lifecycle.spec: inlineprcdobject literals changed identity every render, ping-ponging the layout effect against the hash-paid effect. Hoisted to a stable constgenerateRequestupdates settled withflushEffects()(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/debugand assert the expected message (the log becomes a test assertion):use-kyc-flow.spec,use-lnurl-withdraw.spec,network-error-component.specreceive.spec:decodeInvoiceStringmocked 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 runsconsole.logspies 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
feeReimbursementMemoin home.spec's remote-config mock (crasheduse-transaction-seen-stateonce transactions resolved)homeAutheduser fields (language/username/phone/email) in home.spec mock dataVerification
Note: for the
CI=truegate (and #3816's) to be active on Concourse, the pipeline needs aci/repipesinceCI: truewas added toci/pipeline.ymlin #3816.🤖 Generated with Claude Code