react-native/jest.config.js
Luis Miguel Alvarado ea88fbe229 fix(jest): added sdks dir to testPathIgnorePatterns to prevent hermes specific tests to run (#40734)
Summary:
When we download the `hermes` repo, we also include its tests, so `jest` try to run them.

## Changelog:

[INTERNAL][FIXED]: don't run `hermes` specific tests.

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

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

Test Plan:
1. Build the project
2. yarn test
3. See the failing tests running from the `sdks` directory.

Reviewed By: arushikesarwani94

Differential Revision: D50087482

Pulled By: robhogan

fbshipit-source-id: 012672d69c98d8b8e60012d83470cda45edc2fc6
2023-10-09 15:30:00 -07:00

66 lines
1.9 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');
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/template',
'<rootDir>/packages/react-native/sdks',
'<rootDir>/packages/react-native/Libraries/Renderer',
'<rootDir>/packages/rn-tester/e2e',
],
transformIgnorePatterns: ['node_modules/(?!@react-native/)'],
haste: {
defaultPlatform: 'ios',
platforms: ['ios', 'android'],
},
moduleNameMapper: {
// This module is internal to Meta and used by their custom React renderer.
// In tests, we can just use a mock.
'^ReactNativeInternalFeatureFlags$':
'<rootDir>/packages/react-native/jest/ReactNativeInternalFeatureFlagsMock.js',
},
moduleFileExtensions: ['fb.js'].concat(defaults.moduleFileExtensions),
unmockedModulePathPatterns: [
'node_modules/react/',
'packages/react-native/Libraries/Renderer',
'promise',
'source-map',
'fastpath',
'denodeify',
],
testEnvironment: 'node',
collectCoverageFrom: ['packages/react-native/Libraries/**/*.js'],
coveragePathIgnorePatterns: [
'/__tests__/',
'/vendor/',
'<rootDir>/packages/react-native/Libraries/react-native/',
],
};