Skip reporting benchmark results in test mode (#56435)

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

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]

Reviewed By: lenaic

Differential Revision: D100795458

fbshipit-source-id: 910f0aa5615ea07fd19b3703a2774e13b4531743
This commit is contained in:
Rubén Norte authored and meta-codesync[bot] committed 2026-04-15 02:39:57 -07:00
1 parent 7ac759d9ce
commit c482b936b2
1 file changed
+3 -1
+3 -1
View File
@@ -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 => {