From df95d86c8e98392b97db0b7ac4ed615148ba795d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Tue, 14 Apr 2026 04:19:25 -0700 Subject: [PATCH 1/2] Skip reporting benchmark results in test mode Summary: Avoid printing the result summary table when benchmarks are executed in test mode. In test mode, benchmarks run only a single iteration with no warmup, so the timing results are not meaningful for comparison. The per-suite results table (console.table) was already skipped in test mode, but the benchmark result was still reported to the runner, which could cause the cross-variant comparison table to be printed with meaningless data. This change skips the reportBenchmarkResult call entirely when running in test mode. Changelog: [Internal] Differential Revision: D100795458 --- private/react-native-fantom/src/Benchmark.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/private/react-native-fantom/src/Benchmark.js b/private/react-native-fantom/src/Benchmark.js index a4b8af047b79..f93912bc967e 100644 --- a/private/react-native-fantom/src/Benchmark.js +++ b/private/react-native-fantom/src/Benchmark.js @@ -215,7 +215,9 @@ export function suite( 'Failing focused test to prevent it from being committed', ); } - reportBenchmarkResult(createBenchmarkResultsObject(bench, tasks)); + if (!isTestOnly) { + reportBenchmarkResult(createBenchmarkResultsObject(bench, tasks)); + } }); const test = (name: string, fn: SyncFn, options?: FnOptions): SuiteAPI => { From aa03ec017a54f15b934086dc53b4bd0b74d8e2e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Tue, 14 Apr 2026 04:19:25 -0700 Subject: [PATCH 2/2] Automatically set --runInBand when running benchmarks Summary: When `--benchmarks` is passed to `yarn fantom`, automatically append `--runInBand` to the Jest arguments. This ensures benchmarks run sequentially in the same process, avoiding parallel test execution that would introduce noise in performance measurements. Changelog: [Internal] Differential Revision: D100796022 --- scripts/fantom.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/fantom.sh b/scripts/fantom.sh index 0b34f9807d28..5d4be07aa77c 100755 --- a/scripts/fantom.sh +++ b/scripts/fantom.sh @@ -27,4 +27,8 @@ for arg in "$@"; do esac done +if [[ -n "$FANTOM_RUN_BENCHMARKS" ]]; then + ARGS+=("--runInBand") +fi + yarn jest --config private/react-native-fantom/config/jest.config.js "${ARGS[@]}"