react-native/jest.config.js
Oskar Kwaśniewski 5bd751bd91 fix: running local tests (#46615)
Summary:
This PR fixes running local tests.

### Before

Tests from Pods/ are executed (including Hermes tests)

![CleanShot 2024-09-24 at 10 09 04@2x](https://github.com/user-attachments/assets/5d766321-1099-4970-bc4d-cf20ec1f5d89)

### After

![CleanShot 2024-09-24 at 10 10 24@2x](https://github.com/user-attachments/assets/356b0db3-9278-4cb3-a216-2ca78b623950)

## Changelog:

[INTERNAL] [FIXED] - Make tests run locally

Pull Request resolved: https://github.com/facebook/react-native/pull/46615

Test Plan: 1. Run yarn run test (with and without the change). Make sure you have installed pods.

Reviewed By: huntie

Differential Revision: D63383063

Pulled By: cipolleschi

fbshipit-source-id: d7352f80c0fe4efdbb169e1adc4d5f60179f78e8
2024-09-25 05:51:49 -07:00

74 lines
2.0 KiB
JavaScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
'use strict';
const {defaults} = require('jest-config');
const PODS_LOCATIONS = [
'packages/rn-tester/Pods',
'packages/helloworld/ios/Pods',
];
module.exports = {
transform: {
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$':
'<rootDir>/packages/react-native/jest/assetFileTransformer.js',
'.*': './jest/preprocessor.js',
},
setupFiles: ['./packages/react-native/jest/local-setup.js'],
fakeTimers: {
enableGlobally: true,
legacyFakeTimers: false,
},
snapshotFormat: {
escapeString: true,
printBasicPrototype: true,
},
// This allows running Meta-internal tests with the `-test.fb.js` suffix.
testRegex: '/__tests__/.*-test(\\.fb)?\\.js$',
testPathIgnorePatterns: [
'/node_modules/',
'<rootDir>/packages/react-native/sdks',
'<rootDir>/packages/react-native/Libraries/Renderer',
'<rootDir>/packages/react-native-test-renderer/src',
'<rootDir>/packages/react-native/sdks/hermes/',
...PODS_LOCATIONS,
],
transformIgnorePatterns: ['node_modules/(?!@react-native/)'],
haste: {
defaultPlatform: 'ios',
platforms: ['ios', 'android'],
},
moduleFileExtensions: ['fb.js'].concat(defaults.moduleFileExtensions),
modulePathIgnorePatterns: [
'scripts/.*/__fixtures__/',
'<rootDir>/packages/react-native/sdks/hermes/',
...PODS_LOCATIONS,
],
unmockedModulePathPatterns: [
'node_modules/react/',
'packages/react-native/Libraries/Renderer',
'promise',
'source-map',
'fastpath',
'denodeify',
],
testEnvironment: 'node',
collectCoverageFrom: [
'packages/react-native/Libraries/**/*.js',
'packages/react-native/src/**/*.js',
],
coveragePathIgnorePatterns: [
'/__tests__/',
'/vendor/',
'<rootDir>/packages/react-native/Libraries/react-native/',
],
};