Fix React Native 0.80.2 and Jest 30 compatibility issues#308
Open
jaredmixpanel wants to merge 3 commits intomasterfrom
Open
Fix React Native 0.80.2 and Jest 30 compatibility issues#308jaredmixpanel wants to merge 3 commits intomasterfrom
jaredmixpanel wants to merge 3 commits intomasterfrom
Conversation
- Update Jest configuration for React Native 0.80.2 - Add babel.config.js with @react-native/babel-preset - Fix async method mocks to return promises - Update Jest matchers from toBeCalledWith to toHaveBeenCalledWith - Simplify UUID tests to avoid mock isolation issues - Update dependencies: uuid to v11, React to v19.1.1, @babel/runtime to v7.28.2 - Remove obsolete metro-react-native-babel-preset All tests passing (104/104) with 0 vulnerabilities
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses compatibility issues after updating React Native to 0.80.2 and Jest to 30.0.5 by fixing configuration and test files to work with the new versions.
Key changes include:
- Updated Jest configuration to remove obsolete transform settings and dependencies
- Fixed deprecated Jest matcher methods and async mock configurations
- Simplified UUID generation tests to avoid complex module isolation patterns
Reviewed Changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Updated major dependencies (React Native, Jest, React) and removed obsolete packages |
| babel.config.js | Added Babel configuration with React Native preset for Flow type support |
| tests/persistent.test.js | Simplified UUID tests and removed complex module isolation patterns |
| tests/main.test.js | Removed unused imports that were causing compatibility issues |
| tests/jest_setup.js | Updated Jest mocks to return promises and use current UUID implementation |
| tests/index.test.js | Updated deprecated Jest matchers to current API |
Comments suppressed due to low confidence (4)
package.json:42
- React version 19.1.1 may not exist. Based on my knowledge cutoff in January 2025, React 19 was in development but may not have reached a stable 19.1.1 release. Please verify this version exists and is stable for production use.
"react": "^19.1.1",
package.json:44
- React Test Renderer version 19.1.1 may not exist. This should match the React version, but please verify that this specific version is available and stable.
"react-test-renderer": "^19.1.1"
package.json:38
- babel-jest version 30.0.5 may not exist. Based on my knowledge cutoff, Jest 30 was not yet released. Please verify this version exists and is compatible with the Jest version being used.
"babel-jest": "^30.0.5",
package.json:40
- Jest version 30.0.5 may not exist. Based on my knowledge cutoff in January 2025, Jest had not yet reached version 30. Please verify this version exists and is stable.
"jest": "^30.0.5",
The uuid v4+ requires crypto.getRandomValues which caused crashes in Expo apps. Reverting to the battle-tested 3.3.2 version that works with the existing react-native-get-random-values polyfill implementation.
- Test UUID generation with polyfill - Test persistence to AsyncStorage - Test multiple tokens with separate device IDs - Test distinct ID generation based on device ID - Verify react-native-get-random-values polyfill is imported These tests ensure uuid v3.3.2 works correctly with the polyfill.
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
This PR fixes compatibility issues after running
npm audit fix --forcewhich updated React Native to 0.80.2 and Jest to 30.0.5.Changes
Jest Configuration
babel.config.jswith@react-native/babel-presetto handle Flow type annotationsmockResolvedValuetoBeCalledWithtotoHaveBeenCalledWithDependencies Updated
metro-react-native-babel-presetuuidfrom 3.3.2 to 11.1.0reactandreact-test-rendererto 19.1.1@babel/runtimeto 7.28.2Test Fixes
Test Results
✅ All 104 tests passing
✅ 0 vulnerabilities
✅ Compatible with React Native 0.80.2 and Jest 30.0.5
Testing
npm testnpm auditGithub Copilot Summary
This pull request updates the test assertions in
__tests__/index.test.jsto use Jest's.toHaveBeenCalledWithmatcher instead of.toBeCalledWithwhen verifying calls to native module methods. This change aligns the tests with current Jest best practices and ensures more accurate and idiomatic test assertions.Test assertion improvements:
.toBeCalledWithwith.toHaveBeenCalledWithin assertions forNativeModules.MixpanelReactNativemethod calls, improving test reliability and consistency with Jest standards. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32]