mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
09a910f80b
Summary: Jest 27 [flips defaults](https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults), making "modern" fake timers (ie, `sinonjs/fake-timers`) the default, over "legacy", which we currently use. We're not quite ready for modern timers yet, partly due to Promise polyfills (https://github.com/facebook/react-native/pull/34659), and also some internal issues with specific tests. This makes our use of legacy timers explicit in preparation for an update to Jest. A switch to modern timers may follow later. Changelog: [Internal][Changed] - Prepare for Jest 27+ by making legacy fake timer use explicit Reviewed By: jacdebug Differential Revision: D39383719 fbshipit-source-id: 6a3dc6f8547cc76f7702a5a39c9b30a184303f17
48 lines
1.1 KiB
JavaScript
48 lines
1.1 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';
|
|
|
|
module.exports = {
|
|
transform: {
|
|
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$':
|
|
'<rootDir>/jest/assetFileTransformer.js',
|
|
'.*': './jest/private/preprocessor.js',
|
|
},
|
|
setupFiles: ['./jest/setup.js'],
|
|
timers: 'legacy',
|
|
testRegex: '/__tests__/.*-test\\.js$',
|
|
testPathIgnorePatterns: [
|
|
'/node_modules/',
|
|
'<rootDir>/template',
|
|
'Libraries/Renderer',
|
|
'packages/rn-tester/e2e',
|
|
],
|
|
transformIgnorePatterns: ['node_modules/(?!@react-native/)'],
|
|
haste: {
|
|
defaultPlatform: 'ios',
|
|
platforms: ['ios', 'android'],
|
|
},
|
|
unmockedModulePathPatterns: [
|
|
'node_modules/react/',
|
|
'Libraries/Renderer',
|
|
'promise',
|
|
'source-map',
|
|
'fastpath',
|
|
'denodeify',
|
|
],
|
|
testEnvironment: 'node',
|
|
collectCoverageFrom: ['Libraries/**/*.js'],
|
|
coveragePathIgnorePatterns: [
|
|
'/__tests__/',
|
|
'/vendor/',
|
|
'<rootDir>/Libraries/react-native/',
|
|
],
|
|
};
|