feat(analytics-react-native): add dependency tests and unpin analytics-core#1735
Draft
feat(analytics-react-native): add dependency tests and unpin analytics-core#1735
Conversation
…s-core - Add comprehensive dependency compatibility tests for @amplitude/analytics-core - Tests verify core exports, React Native environment compatibility, and critical bug regressions - Specifically prevents issues like #181 (getGlobalScope/document.cookie crash in Expo) - Unpin @amplitude/analytics-core from 2.41.5 to workspace:* now that tests catch breaking changes - Tests run in both web and mobile environments to ensure compatibility - Related to Linear ticket SDKRN-2
Use type assertion instead of non-null assertion to satisfy TypeScript strict null checking in dependency-compatibility tests.
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 adds comprehensive dependency compatibility tests for
@amplitude/analytics-react-nativeto prevent breaking changes from@amplitude/analytics-coreupgrades, specifically addressing the issue reported in #181.Changes:
Added dependency compatibility tests (
test/dependency-compatibility.test.ts) that verify:@amplitude/analytics-coreare exportedgetGlobalScopeworks correctly whendocumentis undefined (React Native environment)CookieStoragehandles missingdocumentgracefully without throwing errorsMemoryStorage,FetchTransport,UUID,Revenue, andIdentifywork correctlyUnpinned
@amplitude/analytics-corefrom2.41.5back toworkspace:*- now that dependency testing is in place, breaking changes will be caught in CI before they can affect React Native usersContext:
Previously, a breaking change in
analytics-corecaused crashes in Expo/React Native apps due toCookieStorageattempting to accessdocument.cookiewhendocumentwas undefined. The fix was implemented in PR #1594, andanalytics-corewas pinned in PR #1596 as a temporary measure.This PR allows us to safely unpin
analytics-coreby ensuring that similar issues will be caught in CI going forward.Checklist
Slack Thread