Skip to content

Run benchmarks in test mode by default instead of excluding them (#56418)#56418

Closed
rubennorte wants to merge 2 commits intofacebook:mainfrom
rubennorte:export-D100464314
Closed

Run benchmarks in test mode by default instead of excluding them (#56418)#56418
rubennorte wants to merge 2 commits intofacebook:mainfrom
rubennorte:export-D100464314

Conversation

@rubennorte
Copy link
Copy Markdown
Contributor

@rubennorte rubennorte commented Apr 11, 2026

Summary:

Changelog: [internal]

D92150163 excluded benchmark tests by default when running yarn fantom without --benchmarks. This was incorrect because it means benchmarks could silently break without being caught.

This changes the behavior so:

  1. By default (without --benchmarks), benchmarks run in test mode (single iteration for correctness only), ensuring they do not break.
  2. With --benchmarks, benchmarks run in full benchmark mode (multiple iterations for performance measurement).

Also renames FANTOM_FORCE_TEST_MODE to FANTOM_RUN_BENCHMARKS and forceTestModeForBenchmarks to runBenchmarks to better reflect the intent (opt-in to full benchmarks rather than opt-in to test mode).

Reviewed By: sammy-SC

Differential Revision: D100464314

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 11, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Apr 11, 2026

@rubennorte has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100464314.

@meta-codesync meta-codesync bot changed the title Run benchmarks in test mode by default instead of excluding them Run benchmarks in test mode by default instead of excluding them (#56418) Apr 11, 2026
rubennorte added a commit to rubennorte/react-native that referenced this pull request Apr 11, 2026
…ebook#56418)

Summary:

Changelog: [internal]

D92150163 excluded benchmark tests by default when running `yarn fantom` without `--benchmarks`. This was incorrect because it means benchmarks could silently break without being caught.

This changes the behavior so:
1. By default (without `--benchmarks`), benchmarks run in test mode (single iteration for correctness only), ensuring they do not break.
2. With `--benchmarks`, benchmarks run in full benchmark mode (multiple iterations for performance measurement).

Also renames `FANTOM_FORCE_TEST_MODE` to `FANTOM_RUN_BENCHMARKS` and `forceTestModeForBenchmarks` to `runBenchmarks` to better reflect the intent (opt-in to full benchmarks rather than opt-in to test mode).

Differential Revision: D100464314
rubennorte added a commit to rubennorte/react-native that referenced this pull request Apr 11, 2026
…ebook#56418)

Summary:
Pull Request resolved: facebook#56418

Changelog: [internal]

D92150163 excluded benchmark tests by default when running `yarn fantom` without `--benchmarks`. This was incorrect because it means benchmarks could silently break without being caught.

This changes the behavior so:
1. By default (without `--benchmarks`), benchmarks run in test mode (single iteration for correctness only), ensuring they do not break.
2. With `--benchmarks`, benchmarks run in full benchmark mode (multiple iterations for performance measurement).

Also renames `FANTOM_FORCE_TEST_MODE` to `FANTOM_RUN_BENCHMARKS` and `forceTestModeForBenchmarks` to `runBenchmarks` to better reflect the intent (opt-in to full benchmarks rather than opt-in to test mode).

Differential Revision: D100464314
Summary:
Changelog: [internal]

The `FANTOM_BENCHMARK_FILENAME_RE` and `FANTOM_BENCHMARK_SUITE_RE` regexes used the `g` (global) flag, which makes `.test()` stateful — it preserves `lastIndex` between calls. When `getFantomTestConfigs` is called for multiple test files in the same process, the stale `lastIndex` from a previous successful match causes `.test()` to miss the match on the next file, returning `false`. This results in benchmark files intermittently getting the default dev config (`isJsOptimized: false`, `dev: true`), causing them to fail at runtime with "Benchmarks should not be run in development mode".

Removes the `g` flag from both regexes since they are used with `.test()` across different strings and should be stateless.

Differential Revision: D100603612
…ebook#56418)

Summary:

Changelog: [internal]

D92150163 excluded benchmark tests by default when running `yarn fantom` without `--benchmarks`. This was incorrect because it means benchmarks could silently break without being caught.

This changes the behavior so:
1. By default (without `--benchmarks`), benchmarks run in test mode (single iteration for correctness only), ensuring they do not break.
2. With `--benchmarks`, benchmarks run in full benchmark mode (multiple iterations for performance measurement).

Also renames `FANTOM_FORCE_TEST_MODE` to `FANTOM_RUN_BENCHMARKS` and `forceTestModeForBenchmarks` to `runBenchmarks` to better reflect the intent (opt-in to full benchmarks rather than opt-in to test mode).

Reviewed By: sammy-SC

Differential Revision: D100464314
@meta-codesync meta-codesync bot closed this in 7efb4b5 Apr 13, 2026
@facebook-github-tools facebook-github-tools bot added the Merged This PR has been merged. label Apr 13, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Apr 13, 2026

This pull request has been merged in 7efb4b5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant