freshyo/apps/admin-ui/tests/jest.config.js
2026-10-01 00:33:03 +05:30

62 lines
2 KiB
JavaScript

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: ['<rootDir>/tests'],
testMatch: ['<rootDir>/tests/**/*.test.ts', '<rootDir>/tests/**/*.test.tsx'],
setupFiles: ['<rootDir>/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/(.*)$': '<rootDir>/../backend/src/$1',
'^@/(.*)$': '<rootDir>/$1',
'^shared-types$': '<rootDir>/../shared-types',
'^@packages/shared$': '<rootDir>/../../packages/shared',
'^@packages/shared/(.*)$': '<rootDir>/../../packages/shared/$1',
'^global-shared$': '<rootDir>/../../packages/shared',
'^global-shared/(.*)$': '<rootDir>/../../packages/shared/$1',
'^common-ui$': '<rootDir>/../../packages/ui',
'^common-ui/(.*)$': '<rootDir>/../../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('|') +
'))',
],
}