Test An Expo App

Use layered tests. No single test type proves a mobile release.

JavaScript Tests

Install test tooling from the current Expo docs, then configure Jest with jest-expo.

module.exports = {
  preset: 'jest-expo',
  setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
  testMatch: ['**/__tests__/**/*.test.ts?(x)']
};

Run:

npm test
npm run test:coverage

Route Tests

Use Expo Router test helpers for navigation behavior:

import { renderRouter, screen } from 'expo-router/testing-library';

test('opens item detail route', () => {
  renderRouter({
    index: () => null,
    'item/[id]': () => null
  }, {
    initialUrl: '/item/123'
  });

  expect(screen).toHavePathname('/item/123');
});

Built-App Smoke

For native or release-facing changes, install a development or preview build and verify:

  • App opens cold.
  • Main routes load.
  • API calls succeed or fail gracefully offline.
  • Permission prompts show correct text.
  • Login/session state survives restart if relevant.
  • Media, camera, notifications, background modes, or other native APIs work on device.

E2E

Use Maestro or another built-app E2E tool when the flow must survive release packaging.

.maestro/
  smoke.yaml

Keep the first flow tiny: open app, navigate one route, assert visible text, close app.

Gotcha: react-test-renderer is deprecated for React 19-era testing guidance. Prefer React Native Testing Library for component interaction tests.