Files
react-native/private/react-native-fantom/config/jest.config.js
Rubén Norte 5c2b9eda69 Refactor runner to use a single instance of Metro for each run (#52777)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52777

Changelog: [internal]

This significantly speeds up test execution in Fantom (around 2x in OSS and 6x at Meta) by starting a Metro server before all tests runs and reusing it across all tests to build test bundles, instead of spinning up a new Metro instance every time we run each test.

The architecture change (also considering the previous change in buck prebuilds) looks like this:
{F1980689532}

This is how is impacts execution times (compared to the baseline):
* OSS
  * Before: 62s {F1980564286}
  * After: 30s (**2x faster**) {F1980564265}

Reviewed By: andrewdacenko

Differential Revision: D78741903

fbshipit-source-id: b209f88925e49cc2a2067e8df9b7fa9a29b4c8d2
2025-08-04 05:56:51 -07:00

41 lines
1.3 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.
*
* @flow strict
* @format
*/
'use strict';
const baseConfig = require('../../../jest.config');
const path = require('path');
module.exports = {
displayName: 'fantom',
rootDir: path.resolve(__dirname, '../../..') /*:: as string */,
roots: [
'<rootDir>/packages/react-native',
'<rootDir>/packages/rn-tester',
'<rootDir>/packages/polyfills',
'<rootDir>/private/react-native-fantom',
],
moduleFileExtensions: [
...baseConfig.moduleFileExtensions,
'cpp',
'h',
] /*:: as $ReadOnlyArray<string> */,
// This allows running Meta-internal tests with the `-test.fb.js` suffix.
testRegex: '/__tests__/.*-itest(\\.fb)?\\.js$',
testPathIgnorePatterns: baseConfig.testPathIgnorePatterns,
transformIgnorePatterns: ['.*'],
testRunner: '<rootDir>/private/react-native-fantom/runner/index.js',
watchPathIgnorePatterns: ['<rootDir>/private/react-native-fantom/build/'],
globalSetup:
'<rootDir>/private/react-native-fantom/runner/global-setup/setup.js',
globalTeardown:
'<rootDir>/private/react-native-fantom/runner/global-setup/teardown.js',
};