Exclude benchmark tests by default, add --benchmarks flag (#55725)

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

changelog: [internal]

By default, `yarn fantom` now excludes benchmark tests (`*-benchmark-itest.js` files) to speed up regular test runs.

Benchmark tests are typically slower and used for performance analysis rather than correctness testing. Excluding them by default improves the developer experience for everyday test runs.

To run benchmark tests, use the new `--benchmarks` flag:
```
yarn fantom --benchmarks
```

Reviewed By: andrewdacenko

Differential Revision: D92150163

fbshipit-source-id: 4c40ef1ba542c4856221373d8239ba603e8f6620
This commit is contained in:
Samuel Susla authored and meta-codesync[bot] committed 2026-02-25 03:17:00 -08:00
1 parent 63f1e29c18
commit 677330a6d6
3 files changed
+24 -2

No files matched your search

@@ -29,7 +29,12 @@ module.exports = {
] /*:: as $ReadOnlyArray<string> */,
// This allows running Meta-internal tests with the `-test.fb.js` suffix.
testRegex: '/__tests__/.*-itest(\\.fb)?\\.js$',
testPathIgnorePatterns: baseConfig.testPathIgnorePatterns,
testPathIgnorePatterns: [
...baseConfig.testPathIgnorePatterns,
...(process.env.FANTOM_INCLUDE_BENCHMARKS != null
? []
: ['benchmark-itest']),
] /*:: as ReadonlyArray<string> */,
transformIgnorePatterns: ['.*'],
testRunner: '<rootDir>/private/react-native-fantom/runner/index.js',
watchPathIgnorePatterns: ['<rootDir>/private/react-native-fantom/build/'],
@@ -16,6 +16,7 @@ const VALID_ENVIRONMENT_VARIABLES = [
'FANTOM_FORCE_CI_MODE',
'FANTOM_FORCE_OSS_BUILD',
'FANTOM_FORCE_TEST_MODE',
'FANTOM_INCLUDE_BENCHMARKS',
'FANTOM_LOG_COMMANDS',
'FANTOM_PRINT_OUTPUT',
'FANTOM_DEBUG_JS',
+17 -1
View File
@@ -16,4 +16,20 @@ fi
export NODE_OPTIONS='--max-old-space-size=8192'
yarn jest --config private/react-native-fantom/config/jest.config.js "$@"
# Parse arguments to check for --benchmarks flag
INCLUDE_BENCHMARKS=false
ARGS=()
for arg in "$@"; do
if [[ "$arg" == "--benchmarks" ]]; then
INCLUDE_BENCHMARKS=true
else
ARGS+=("$arg")
fi
done
# When --benchmarks is passed, set env var so jest.config.js includes benchmark tests
if [[ "$INCLUDE_BENCHMARKS" == true ]]; then
FANTOM_INCLUDE_BENCHMARKS=1 yarn jest --config private/react-native-fantom/config/jest.config.js "${ARGS[@]}"
else
yarn jest --config private/react-native-fantom/config/jest.config.js "${ARGS[@]}"
fi