const path = require('path') const appRoot = path.resolve(__dirname, '..') /** * Jest project for apps/admin-ui integration tests. * * Mirrors apps/user-ui/tests/jest.config.js. Tests live under tests/ and are * kept out of the app build by living outside the app/ route tree. */ module.exports = { preset: 'jest-expo', rootDir: appRoot, roots: ['/tests'], testMatch: ['/tests/**/*.test.ts', '/tests/**/*.test.tsx'], setupFiles: ['/tests/setup.ts'], clearMocks: true, // The suites are heavy (expo-router + react-query + fake timers) and several // install module-level fakes; running them in parallel workers exhausts // resources and hangs. Serial is ~80s and stable. maxWorkers: 1, forceExit: true, moduleNameMapper: { '^@backend/(.*)$': '/../backend/src/$1', '^@/(.*)$': '/$1', '^shared-types$': '/../shared-types', '^@packages/shared$': '/../../packages/shared', '^@packages/shared/(.*)$': '/../../packages/shared/$1', '^global-shared$': '/../../packages/shared', '^global-shared/(.*)$': '/../../packages/shared/$1', '^common-ui$': '/../../packages/ui', '^common-ui/(.*)$': '/../../packages/ui/$1', }, transformIgnorePatterns: [ 'node_modules/(?!(?:.pnpm/)?(' + [ '(jest-)?react-native', '@react-native(-community)?', 'expo(nent)?', '@expo(nent)?/.*', '@expo-google-fonts/.*', 'react-navigation', '@react-navigation/.*', '@sentry/react-native', 'native-base', 'react-native-svg', 'react-native-gesture-handler', 'react-native-reanimated', 'react-native-safe-area-context', 'react-native-screens', 'react-native-draggable-flatlist', 'react-native-tab-view', 'react-native-toast-message', '@trpc/.*', '@tanstack/.*', 'twrnc', 'zod', '@testing-library/react-native', ].join('|') + '))', ], }