Eve library

arete/mobile — Jest Failure Triage

Other

Revision 1

On this page

Status: 38 failed suites / 44 passed of 82 total (211 failed tests of 1952 total) as of 2026-05-28. Closes #70 with a triage; the per-test fixes are tracked individually and land alongside each screen's next PR.

Failure breakdown by root cause#

After running npx jest --silent against the full suite, the 38 failing suites cluster into four root causes:

1. fireEvent.press no-op — 18 suites (≈48%)#

text
expect(jest.fn()).toHaveBeenCalled()
Expected number of calls: >= 1
Received number of calls:    0

Files: SleepTrackerScreen, HabitRemindersScreen, WellnessDashboardScreen, TasksInboxScreen, WheelOfLifeScreen, OKRScreen, EnergyTrackerScreen, HabitDetailScreen, GoalDetailScreen, GoalProgressScreen, HabitAnalyticsScreen, MoodTrackerScreen, BreathingExerciseScreen, NutritionTrackerScreen, JournalEntryScreen, MorningRoutineScreen, EveningRoutineScreen, FocusTimerScreen.

Root cause: react-native-testing-library's fireEvent.press now requires the pressable to have accessible={true} (a behavior change in v12+). Several screens render Pressable / TouchableOpacity that don't set this and the press is silently dropped. Fix per-screen: add accessible accessibilityRole="button" to each interactive element, or use userEvent.press from @testing-library/react-native v12+ which doesn't have this restriction.

2. screen.toContain against fragment text — 9 suites (≈24%)#

text
expect(container).toContain('expected text')

Files: App.test.tsx, ValuesScreen, VisionBoardScreen, OnboardingScreen, SettingsScreen, ProfileScreen, NotificationSettingsScreen, PrivacySettingsScreen, AboutScreen.

Root cause: i18n strings moved into the i18next bundle; the test asserts the old hard-coded English string. Each test needs to either import the translation key + assert the rendered key value, or use getByTestId instead of text-matching.

3. react-test-renderer async batching — 8 suites (≈21%)#

text
at performWorkOnRootViaSchedulerTask
  (.../react-test-renderer.development.js:2908:7)

Files: CoachChatScreen, ConversationScreen, MessageThreadScreen, NotificationCenterScreen, ReminderListScreen, CalendarScreen, WeeklyReviewScreen, MonthlyReviewScreen.

Root cause: React 19 / RN 0.85 changed scheduler timing; these tests use await waitFor(...) without an act() wrapper, so state updates batch after the assertion runs. Fix per-test: wrap the trigger in await act(async () => { ... }) and move the assertion inside the waitFor callback.

4. ImagePicker aspect-ratio role — 3 suites#

text
expect(ratio.props.accessibilityRole).toBe('radio')

Files: ImagePickerCropper.test.tsx, CameraCaptureScreen.test.tsx, PhotoLibraryScreen.test.tsx.

Root cause: the new @react-native-community/cli aspect-ratio chip component uses accessibilityRole="adjustable" instead of "radio" (actually more semantically correct for a ratio picker). Tests were written against the previous role.

Fix path#

The 38 suites are not blocking arete/mobile from running — the app boots fine; these failures are test-logic drift behind library upgrades. Per the project's testing-pyramid policy, each fix lands alongside the next PR touching the relevant screen so the engineer who knows the component's intent owns the test rewrite.

A blanket fix-all PR is discouraged because:

  • fireEvent.press → userEvent.press rewrites change test semantics (userEvent applies focus + press; fireEvent only press), and per-screen the right rewrite varies (some tests want the bare press, others depend on focus side effects).
  • The i18n string assertions sometimes test the rendered text and sometimes test the translation-key resolution; only the screen author knows which is intended.
  • The act() wrapping varies depending on whether the test was asserting initial render vs. post-interaction state.

Until each fix lands, apps/arete/mobile's CI badge will stay red on the jest job. That's intentional — making it green by skipping the suites would hide the drift; failing makes the test debt visible.

Until fixes land#

  • pnpm jest shows the 38 failures clearly.
  • pnpm jest --testPathIgnorePatterns="screens/(coach|balance|...)" can run only the green suites if a contributor needs a green local signal while iterating elsewhere.
  • The mobile-build-smoke.yml workflow (#83) does NOT run jest — it's a build-only check; the jest failures don't block it.