Commit 4bdfaf2
Fix stateful regex bug in benchmark detection (#56423)
Summary:
Pull Request resolved: #56423
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.
___
overriding_review_checks_triggers_an_audit_and_retroactive_review
Oncall Short Name: react_native_iroc
Differential Revision: D100603612
fbshipit-source-id: 4eded9b0a59a2343ad44c0c1c2855466e3981b7a1 parent a8b39a2 commit 4bdfaf2
1 file changed
+2
-2
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
0 commit comments