docs(migration): document known limits + transform-allowlist from real runs#66
Merged
Conversation
…l runs Expand the Migrating from Jest guide with the empirically-derived reality of a real migration: - A 'Known limits' section: assertions coupled to Jest's RN mock internals that can't port under a real-RN engine (jest.spyOn(View.prototype, …), mocks of RN internal submodules, raw source-shape assertions, jest.mock nested in callbacks), with what to do for each. - An Expo-core caveat (dev-server/init plumbing expects a Metro connection). - Concrete transform-allowlist guidance: the JSX-in-.js third-party-lib parse error and adding the package to transform (the transformIgnorePatterns replacement), plus vi.mock needing the lib in the Vite graph. Applied to both the website guide and the packaged docs copy.
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.
What
Expands the Migrating from Jest guide with the empirically-derived reality of a real migration, from friction audits across the obytes, react-native-paper, and rneui suites:
jest.spyOn(View.prototype, 'measure'/'measureInWindow')(real RN'sViewis aforwardRef, no prototype method)jest.mock('react-native/Libraries/…')of internal submodules + spying them (externalized RN isn't intercepted)source-shape assertions (real RN normalizessource)jest.mock('react-native', …)nested inbeforeAll/describecallbacks (Jest doesn't hoist those; vitest-native applies mocks more consistently)expopreset are unaffected.transformallowlist guidance — the JSX-in-.jsthird-party-lib parse error (a lib pointing itsreact-native/modulefield at untranspiledsrc/) and the fix (add the package totransform), as the direct replacement fortransformIgnorePatterns; also notingvi.mockneeds the lib in the Vite graph.Applied to both the website guide and the packaged
docs/copy so they stay consistent.Why
The guide already covered the mechanical steps but set the expectation that remaining failures are "usually a missing query update." The audits showed a distinct, nameable class of Jest-mock-coupled assertions that won't port — documenting them sets honest expectations and tells migrators what to rewrite vs. chase.
Validation
vitepress build websiterenders cleanly with these changes.Note (separate issue, not in this PR)
While validating, found that
website/guide/fidelity.md(a generated file from the fidelity-report pipeline) contains a bare<Text>in a table cell that VitePress parses as an unclosed tag, which breaksvitepress buildon main (and thus the Pages deploy). The fix belongs in the report generator (escape/backtick-wrap angle-bracket tokens); filing separately.