Improve Fantom documentation in __docs__/README.md (#56660)#56660
Closed
rubennorte wants to merge 1 commit into
Closed
Improve Fantom documentation in __docs__/README.md (#56660)#56660rubennorte wants to merge 1 commit into
rubennorte wants to merge 1 commit into
Conversation
|
@rubennorte has exported this pull request. If you are a Meta employee, you can view the originating Diff in D103217408. |
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
d72353e to
ebf16dd
Compare
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
ebf16dd to
84a6cb9
Compare
|
This pull request has been merged in 29d8405. |
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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Expand
private/react-native-fantom/__docs__/README.mdso it's the single source of truth for Fantom usage.Added sections:
setUpDefaultReactNativeEnvironmentand explicitly warn againstInitializeCore(which installs LogBox and breaks Fantom's error handling). All real-itest.jsfiles use this import.### Conventionssection:__tests__placement,-benchmark-itest.jssuffix, usingFantom.runTask()for rendering, theensureInstancehelper, component-specific instance types, ref-based element access, testing imperative APIs / method timing / edge cases,takeMountingManagerLogsfor command verification, and "don't oversimplify assertions" / "avoid trivial tests" guidance.### Assertionssection: prefer.toEqual()+ inline JSX over.toMatchSnapshot(), full examples forgetRenderedOutput().toJSX()withincludeLayoutMetricsand thepropsfilter, plus an element-level assertion example coveringtagName,getBoundingClientRect, and child structure.### Limitationssection: cannot nestrunTask(), subset of Jest API, tests must live underpackages/react-native.#### C++ sampling profilersubsection under Profiling, documentingFANTOM_PROFILE_CPP(parallel to the existing JS profiler section).Pure API references (
setLogBoxCheckEnabled,dispatchNativeEvent,scheduleTask,enqueueNativeEvent,runOnUIThread,runWorkLoop,scrollTo,takeJSMemoryHeapSnapshot,createRootoptions, etc.) are not duplicated — they continue to live in the inline source docs insrc/index.js, which the README points to.Changelog: [Internal]
Reviewed By: mdvacca, cipolleschi
Differential Revision: D103217408