Repository navigation
Reject conflicting Fantom inline snapshot updates before writing source - #60593
Draft
GianSandoval5 wants to merge 1 commit into
Draft
GianSandoval5 wants to merge 1 commit into
GianSandoval5 wants to merge 1 commit into
Conversation
This branch has not been deployed
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:
When multiple tests reach one inline snapshot call with different values, Fantom's source writer silently keeps the last value. The initial run can pass while modifying the file to fit only one test; the next run then fails, and updating snapshots can alternate the saved value.
Validate all pending values before rewriting the source and reject conflicting values for the same line. Keep coalescing identical values, since Fantom combines pending updates across configurations. This deliberately preserves that existing behavior rather than adopting Jest's rejection of every repeated call.
Fixes #60591.
The existing line-based locator is unchanged; this does not add support for multiple inline snapshot calls on one source line. Only the Node-side writer and its Jest tests change.
Changelog:
[INTERNAL] [FIXED] - Fantom: reject conflicting inline snapshot updates before modifying test source.
Test Plan:
Base:
27acce22615ee0682eb018826a000240da90c2d9. Ubuntu 22.04, Node 24.22.3, Yarn 1.22.22.Five new test cases cover conflicts during creation and update with the whole file unchanged, identical values across configurations, and distinct calls including a multiline snapshot.
yarn jest private/react-native-fantom --runInBand --ci: 196 passed, 0 failed, 0 skipped, 16 suites, exit 0.yarn prettier --checkon both changed files: exit 0.yarn eslint --max-warnings 0on both changed files: exit 0.yarn flow-check --max-workers 2 --json: exit 0 for both baseline production source and patched source.439b0c3d23046a4b689ee68af6de7f4438e9102cis identical to the tested commit; verification files stay on a separate fork branch.Not run: the author's full Metro/Hermes/native Fantom reproducer, Android/iOS builds, RNTester, the entire monorepo Jest suite or repository-wide ESLint. This validates the actual Node source writer and Fantom's regular Jest suites, not native platforms or end-to-end Fantom execution.
AI-assisted preparation, kept as a draft for Gian's personal review and end-to-end follow-up. No CLA has been signed on the contributor's behalf; Meta CLA eligibility must be resolved before merge.