mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56541 The Fantom test runner spawns native `fantom-tester` binaries built in either dev or opt mode based on each test's `fantom_mode` pragma. When collecting C++ code coverage of the tester binary, however, the build may switch to a coverage-instrumented build configuration that does not define `REACT_NATIVE_DEBUG`. That breaks dev-mode tests that rely on debug-only native APIs. For example, `installHighResTimeStampMock` in `private/react-native-fantom/tester/src/NativeFantom.cpp` is gated on `#ifdef REACT_NATIVE_DEBUG` and throws "Mocking timers is not supported in optimized builds" otherwise. Tests like `LongTasksAPI-itest.js` (no `fantom_mode` pragma → defaults to dev) fail in CI coverage runs with that error. When invoking buck with coverage enabled, layer the `hermes_build_mode` constraint on top of the build platform so `rn_build_mode()` (in `tools/build_defs/oss/rn_defs.bzl`) picks up the right value and adds `-DREACT_NATIVE_DEBUG` for dev tests. Reviewed By: fkgozali Differential Revision: D101832028 fbshipit-source-id: cfb5269dea846f41d9d1f9af1c5ff8bd5828085c