Skip to content

Migrate remaining StyleSheet Jest tests to Fantom#57261

Closed
rubennorte wants to merge 2 commits into
react:mainfrom
rubennorte:export-D108759085
Closed

Migrate remaining StyleSheet Jest tests to Fantom#57261
rubennorte wants to merge 2 commits into
react:mainfrom
rubennorte:export-D108759085

Conversation

@rubennorte

Copy link
Copy Markdown
Contributor

Summary:
Migrates the remaining StyleSheet unit tests from regular Jest (-test.js) to Fantom (-itest.js): normalizeColor, processColor, processColorArray, processBackgroundImage, and StyleSheet. These run on the React Native client at runtime, so they now run on Hermes in the real runtime.

Adaptations (no coverage weakened):

  • Replaced jest.spyOn(console, ...) with manual save/replace/restore of the console method (Fantom does not provide jest.spyOn), both to assert and to suppress expected output.
  • Replaced the module-mock delegation check in normalizeColor (which relied on jest.mock) with a behavioral assertion on the real implementation.
  • These tests run on the Android runtime under Fantom (Jest defaulted to iOS); platform-specific requires were moved next to their platform branches where needed.

Changelog: [Internal]

Differential Revision: D108759085

rubennorte and others added 2 commits June 18, 2026 02:36
Summary:
Migrates the pure-logic StyleSheet unit tests from regular Jest (`-test.js`) to Fantom (`-itest.js`), so they run on Hermes inside the real React Native runtime, the same engine that runs this code in production.

Migrated files (all style-processing utilities that run on the client at runtime): `flattenStyle`, `processAspectRatio`, `processBackgroundPosition`, `processBackgroundRepeat`, `processBackgroundSize`, `processFilter`, `processFontVariant`, `processTransform`, `processTransformOrigin`, `setNormalizedColorAlpha`, `splitLayoutProps`.

Notable adaptations:
- `toThrowErrorMatchingSnapshot()` and `toThrowErrorMatchingInlineSnapshot()` are not available in Fantom, so they were replaced with `toThrow('<exact message>')`, preserving the exact error messages that were previously captured in snapshots.
- Removed the now-obsolete file snapshots for `processAspectRatio`, `processTransform`, and `processTransformOrigin`.
- `toMatchInlineSnapshot` (used by `splitLayoutProps`) is supported by Fantom and was kept unchanged.

Changelog: [Internal]

Differential Revision: D108759084
Summary:
Migrates the remaining StyleSheet unit tests from regular Jest (`-test.js`) to Fantom (`-itest.js`): `normalizeColor`, `processColor`, `processColorArray`, `processBackgroundImage`, and `StyleSheet`. These run on the React Native client at runtime, so they now run on Hermes in the real runtime.

Adaptations (no coverage weakened):
- Replaced `jest.spyOn(console, ...)` with manual save/replace/restore of the `console` method (Fantom does not provide `jest.spyOn`), both to assert and to suppress expected output.
- Replaced the module-mock delegation check in `normalizeColor` (which relied on `jest.mock`) with a behavioral assertion on the real implementation.
- These tests run on the Android runtime under Fantom (Jest defaulted to iOS); platform-specific requires were moved next to their platform branches where needed.

Changelog: [Internal]

Differential Revision: D108759085
@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 Jun 18, 2026
@meta-codesync

meta-codesync Bot commented Jun 18, 2026

Copy link
Copy Markdown

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

@meta-codesync meta-codesync Bot closed this in 9e900af Jun 18, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Jun 18, 2026
@meta-codesync

meta-codesync Bot commented Jun 18, 2026

Copy link
Copy Markdown

This pull request has been merged in 9e900af.

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. 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.

1 participant