Jest test cases failing due to timeout of react native test library

709 views Asked by At

I am using jest for react-native test cases, after updating to jest v27.5.1, I started getting error for all of the async calls. I solved most of them by following this thread. After this I started getting issue from testing-library for react-native. I tried exceeding timeout value but even at 90000ms it still remains same.

    thrown: "Exceeded timeout of 90000 ms for a hook.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

   5 | import { I18nProvider } from '@lingui/react';
   6 | import { renderHook } from '@testing-library/react-hooks';
>  7 | import { render } from '@testing-library/react-native';

my jest config:

    const ignoreLibs = [
  'react-native/.*',
  'react-native',
  '@react-native',
  'react-navigation',
  '@react-navigation',
  '@react-native-community',
  '@sentry/*',
  'victory*',
  'd3-format',
  'p-cancelable',
].join('|');
const transformIgnorePatterns = 'node_modules/(?!((jest-)?' + ignoreLibs + '))';

module.exports = {
  testTimeout: 90000,
  preset: 'react-native',
  bail: false,
  collectCoverage: true,
  collectCoverageFrom: [
    `./src/**/*.{ts,tsx}`,
    '!**/data-mocks/**',
    '!**/__mocks__/**',
    '!**/test/**',
    '!**/api/demo/**',
    '!**/api/dtos/**',
    '!**/constants/**',
    '!**/type-definitions/**',
    '!**/types.{ts,tsx}',
    '!**/index.{ts,tsx}',
  ],
  coverageReporters: ['lcov'],
  globalSetup: '../globalSetup.js',
  testEnvironment: 'jsdom',
  testMatch: [`**/__tests__/**/test*.{ts,tsx}`],
  timers: 'legacy',
  transform: {
    '^.+\\.(js|jsx|ts|tsx)$': 'babel-jest',
    '^.+\\.svg$': '<rootDir>/jest-svg-transformer.js',
  },
  transformIgnorePatterns: [transformIgnorePatterns],
  setupFiles: ['../setupTestMocks.js'],
};
0

There are 0 answers