Skip to content

Improve Fantom documentation in __docs__/README.md (#56660)#56660

Closed
rubennorte wants to merge 1 commit into
react:mainfrom
rubennorte:export-D103217408
Closed

Improve Fantom documentation in __docs__/README.md (#56660)#56660
rubennorte wants to merge 1 commit into
react:mainfrom
rubennorte:export-D103217408

Conversation

@rubennorte

@rubennorte rubennorte commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Summary:

Expand private/react-native-fantom/__docs__/README.md so it's the single source of truth for Fantom usage.

Added sections:

  • Updated the Usage example to import setUpDefaultReactNativeEnvironment and explicitly warn against InitializeCore (which installs LogBox and breaks Fantom's error handling). All real -itest.js files use this import.
  • New ### Conventions section: __tests__ placement, -benchmark-itest.js suffix, using Fantom.runTask() for rendering, the ensureInstance helper, component-specific instance types, ref-based element access, testing imperative APIs / method timing / edge cases, takeMountingManagerLogs for command verification, and "don't oversimplify assertions" / "avoid trivial tests" guidance.
  • New ### Assertions section: prefer .toEqual() + inline JSX over .toMatchSnapshot(), full examples for getRenderedOutput().toJSX() with includeLayoutMetrics and the props filter, plus an element-level assertion example covering tagName, getBoundingClientRect, and child structure.
  • New ### Limitations section: cannot nest runTask(), subset of Jest API, tests must live under packages/react-native.
  • New #### C++ sampling profiler subsection under Profiling, documenting FANTOM_PROFILE_CPP (parallel to the existing JS profiler section).

Pure API references (setLogBoxCheckEnabled, dispatchNativeEvent, scheduleTask, enqueueNativeEvent, runOnUIThread, runWorkLoop, scrollTo, takeJSMemoryHeapSnapshot, createRoot options, etc.) are not duplicated — they continue to live in the inline source docs in src/index.js, which the README points to.

Changelog: [Internal]

Reviewed By: mdvacca, cipolleschi

Differential Revision: D103217408

@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 30, 2026
@meta-codesync

meta-codesync Bot commented Apr 30, 2026

Copy link
Copy Markdown

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

@meta-codesync meta-codesync Bot changed the title Improve Fantom documentation in __docs__/README.md Improve Fantom documentation in __docs__/README.md (#56660) Apr 30, 2026
rubennorte added a commit to rubennorte/react-native that referenced this pull request Apr 30, 2026
Summary:

Expand `private/react-native-fantom/__docs__/README.md` so it's the single source of truth for Fantom usage.

Added sections:
- Updated the Usage example to import `setUpDefaultReactNativeEnvironment` and explicitly warn against `InitializeCore` (which installs LogBox and breaks Fantom's error handling). All real `-itest.js` files use this import.
- New `### Conventions` section: `__tests__` placement, `-benchmark-itest.js` suffix, using `Fantom.runTask()` for rendering, the `ensureInstance` helper, component-specific instance types, ref-based element access, testing imperative APIs / method timing / edge cases, `takeMountingManagerLogs` for command verification, and "don't oversimplify assertions" / "avoid trivial tests" guidance.
- New `### Assertions` section: prefer `.toEqual()` + inline JSX over `.toMatchSnapshot()`, full examples for `getRenderedOutput().toJSX()` with `includeLayoutMetrics` and the `props` filter, plus an element-level assertion example covering `tagName`, `getBoundingClientRect`, and child structure.
- New `### Limitations` section: cannot nest `runTask()`, subset of Jest API, tests must live under `packages/react-native`.
- New `#### C++ sampling profiler` subsection under Profiling, documenting `FANTOM_PROFILE_CPP` (parallel to the existing JS profiler section).

Pure API references (`setLogBoxCheckEnabled`, `dispatchNativeEvent`, `scheduleTask`, `enqueueNativeEvent`, `runOnUIThread`, `runWorkLoop`, `scrollTo`, `takeJSMemoryHeapSnapshot`, `createRoot` options, etc.) are not duplicated — they continue to live in the inline source docs in `src/index.js`, which the README points to.

Changelog: [Internal]

Differential Revision: D103217408
Summary:

Expand `private/react-native-fantom/__docs__/README.md` so it's the single source of truth for Fantom usage.

Added sections:
- Updated the Usage example to import `setUpDefaultReactNativeEnvironment` and explicitly warn against `InitializeCore` (which installs LogBox and breaks Fantom's error handling). All real `-itest.js` files use this import.
- New `### Conventions` section: `__tests__` placement, `-benchmark-itest.js` suffix, using `Fantom.runTask()` for rendering, the `ensureInstance` helper, component-specific instance types, ref-based element access, testing imperative APIs / method timing / edge cases, `takeMountingManagerLogs` for command verification, and "don't oversimplify assertions" / "avoid trivial tests" guidance.
- New `### Assertions` section: prefer `.toEqual()` + inline JSX over `.toMatchSnapshot()`, full examples for `getRenderedOutput().toJSX()` with `includeLayoutMetrics` and the `props` filter, plus an element-level assertion example covering `tagName`, `getBoundingClientRect`, and child structure.
- New `### Limitations` section: cannot nest `runTask()`, subset of Jest API, tests must live under `packages/react-native`.
- New `#### C++ sampling profiler` subsection under Profiling, documenting `FANTOM_PROFILE_CPP` (parallel to the existing JS profiler section).

Pure API references (`setLogBoxCheckEnabled`, `dispatchNativeEvent`, `scheduleTask`, `enqueueNativeEvent`, `runOnUIThread`, `runWorkLoop`, `scrollTo`, `takeJSMemoryHeapSnapshot`, `createRoot` options, etc.) are not duplicated — they continue to live in the inline source docs in `src/index.js`, which the README points to.

Changelog: [Internal]

Reviewed By: mdvacca, cipolleschi

Differential Revision: D103217408
@meta-codesync

meta-codesync Bot commented Apr 30, 2026

Copy link
Copy Markdown

This pull request has been merged in 29d8405.

@facebook-github-tools facebook-github-tools Bot added the Merged This PR has been merged. label Apr 30, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @rubennorte in 29d8405

When will my fix make it into a release? | How to file a pick request?

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.

2 participants