Repository navigation
Description
Description
When a heap snapshot fails because Hermes has no memory instrumentation, takeJSMemoryHeapSnapshot in private/react-native-fantom/src/index.js adds to its error "please call Fantom with FANTOM_ENABLE_MEMORY_INSTRUMENTATION=1 (only works locally with Buck)" (L794). The variable Fantom reads is FANTOM_ENABLE_JS_MEMORY_INSTRUMENTATION (EnvironmentOptions.js L23, L87), and validateEnvironmentVariables throws for any other FANTOM_ variable (L94-L103). Global setup calls it before anything else (globalSetup.js L37), so a run started the way the error says stops before any test.
Steps to reproduce
- In a checkout of
main(c1acb2b) afteryarn install, run Fantom's Jest config with the variable the error names. This is the commandyarn fantomruns once its tester is built, with theFANTOM_FORCE_OSS_BUILD=1it exports:
FANTOM_ENABLE_MEMORY_INSTRUMENTATION=1 FANTOM_FORCE_OSS_BUILD=1 yarn jest --config private/react-native-fantom/config/jest.config.js private/react-native-fantom/src/__tests__/FantomModeDefault-itest.jsOr run node repro.cjs <path to the checkout> from the reproducer below, which runs it with that variable and with FANTOM_ENABLE_JS_MEMORY_INSTRUMENTATION=1, and exits 1 while the defect shows.
Expected: the error names the variable Fantom reads, FANTOM_ENABLE_JS_MEMORY_INSTRUMENTATION=1, so global setup takes it; in CI and OSS it still stops with "Memory instrumentation is not supported in CI or OSS environments", as it does for that variable now.
Actual: global setup throws Unexpected Fantom environment variable: FANTOM_ENABLE_MEMORY_INSTRUMENTATION=1.
React Native Version
main at c1acb2b (nightly)
Affected Platforms
Build - Windows
Output of npx @react-native-community/cli info
Not applicable: this is Fantom's runner in React Native's own repository. The reproducer's run:
react-native c1acb2bd63c (2026-11-16), Windows_NT 10.0.26300, node v26.12.1
Stacktrace or Logs
react-native c1acb2bd63c (2026-11-16), Windows_NT 10.0.26300, node v26.12.1
private/react-native-fantom/src/index.js:794: 'please call Fantom with FANTOM_ENABLE_MEMORY_INSTRUMENTATION=1 ' +
private/react-native-fantom/runner/EnvironmentOptions.js:23: 'FANTOM_ENABLE_JS_MEMORY_INSTRUMENTATION',
private/react-native-fantom/runner/EnvironmentOptions.js:87: process.env.FANTOM_ENABLE_JS_MEMORY_INSTRUMENTATION,
$ FANTOM_ENABLE_MEMORY_INSTRUMENTATION=1 FANTOM_FORCE_OSS_BUILD=1 yarn jest --config private/react-native-fantom/config/jest.config.js private/react-native-fantom/src/__tests__/FantomModeDefault-itest.js
jest exited 1
global setup threw: Unexpected Fantom environment variable: FANTOM_ENABLE_MEMORY_INSTRUMENTATION=1. Accepted variables are: FANTOM_DEBUG_CPP, FANTOM_ENABLE_ASAN, FANTOM_ENABLE_TSAN, FANTOM_FORCE_CI_MODE, FANTOM_FORCE_OSS_BUILD, FANTOM_RUN_BENCHMARKS, FANTOM_LOG_COMMANDS, FANTOM_PRINT_OUTPUT, FANTOM_DEBUG_JS, FANTOM_PROFILE_JS, FANTOM_PROFILE_CPP, FANTOM_ENABLE_JS_MEMORY_INSTRUMENTATION
$ FANTOM_ENABLE_JS_MEMORY_INSTRUMENTATION=1 FANTOM_FORCE_OSS_BUILD=1 yarn jest --config private/react-native-fantom/config/jest.config.js private/react-native-fantom/src/__tests__/FantomModeDefault-itest.js
jest exited 1
global setup threw: Memory instrumentation is not supported in CI or OSS environments, as it requires a custom Hermes build that is not prebuilt in those environments.
SUMMARY: the heap snapshot error advises FANTOM_ENABLE_MEMORY_INSTRUMENTATION=1, and Fantom's global setup rejects it: "Unexpected Fantom environment variable: FANTOM_ENABLE_MEMORY_INSTRUMENTATION=1"; FANTOM_ENABLE_JS_MEMORY_INSTRUMENTATION=1 is the variable it reads (global setup: "Memory instrumentation is not supported in CI or OSS environments, as it requires a custom Hermes build that is not prebuilt in those environments.")
MANDATORY Reproducer
https://github.com/YevheniiKotyrlo/rn-fantom-heap-snapshot-env-var-repro — node repro.cjs <path to a react-native checkout> exits 1 while global setup rejects the variable the heap snapshot error names, and 0 once that variable turns memory instrumentation on.
Screenshots and Videos
No response
Activity