Conversation
Node-based CLI that copies SDK upload/error-handling logic for e2e testing against mock server. Includes E2E_TEST_SUITES for selective test execution. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make apiHost and cdnHost optional in the CLI input type contract. Add e2e-cli README documenting the input/output format and parameters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace copied SDK functions with real imports from the SDK source. Events now flow through the full pipeline: SegmentClient → Timeline → SegmentDestination (batch chunking) → QueueFlushingPlugin (queue) → uploadEvents HTTP POST. Three minimal stubs replace React Native runtime dependencies: - react-native: mocks AppState, NativeModules, Platform - @segment/sovran-react-native: re-exports real store.ts + bridge.ts, bypassing the RN bridge entry point - react-native-get-random-values: no-op (Node.js has native crypto) Uses esbuild to bundle CLI + SDK source + stubs into dist/cli.js. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Per-SDK config and convenience script for the generic test runner in sdk-e2e-tests. Run ./e2e-cli/run-e2e.sh to build and test locally. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace hardcoded env vars and direct npm test call with ./scripts/run-tests.sh which reads e2e-config.json for test configuration. This ensures CI uses the same config as local runs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The e2e-cli directory has its own tsconfig and is not part of the SDK's lint setup. Excluding it prevents ESLint parsing errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
abueide
requested changes
Feb 19, 2026
- Align types with sdk-e2e-tests (AnalyticsEvent, EventSequence, CLIConfig, CLIOutput with sentBatches) - Fix screen to use evt.name instead of evt.event - Fix group to use evt.groupId instead of evt.event - Replace non-null assertions with validation errors - Add page event type (throws: not supported on mobile) - Add default case for unknown event types - Remove AsyncStoragePersistor export from sovran stub (pulls in @react-native-async-storage which breaks Node.js) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mobile SDKs don't have a page method. Kotlin and Swift CLIs already map page → screen silently. Match that behavior here instead of throwing an error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The CLI should be a thin pass-through so e2e tests observe actual SDK behavior for missing fields, not CLI pre-validation errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use team-suggested validation pattern: warn on missing/invalid required fields and skip the event, validate optional fields and proceed without them if invalid, catch per-event errors so one bad event doesn't fail the entire sequence. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces an E2E test CLI for the analytics-react-native SDK that enables running the complete SDK pipeline on Node.js without a React Native runtime. The CLI stubs React Native dependencies (AppState, NativeModules, sovran native bridge, AsyncStorage) with minimal Node.js equivalents, allowing the full event processing pipeline to execute in a standard Node.js environment. This enables automated cross-SDK E2E testing in CI/CD pipelines.
Changes:
- Added e2e-cli package with TypeScript source, build configuration, and React Native stubs
- Implemented CLI that accepts JSON input defining event sequences and outputs success/failure status
- Added GitHub Actions workflow to run E2E tests against the sdk-e2e-tests repository
- Added shell script to build the CLI and invoke the test suite
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
| e2e-cli/tsconfig.json | TypeScript configuration with path mappings for React Native stubs |
| e2e-cli/src/stubs/sovran.ts | Stub re-exporting pure TypeScript implementations from sovran package |
| e2e-cli/src/stubs/react-native.ts | Minimal React Native API stub providing AppState, NativeModules, and Platform |
| e2e-cli/src/stubs/react-native-get-random-values.ts | No-op stub relying on Node.js 18+ native crypto |
| e2e-cli/src/cli.ts | Main CLI implementation processing events through the real SDK pipeline |
| e2e-cli/run-e2e.sh | Shell script to build CLI and run E2E tests |
| e2e-cli/package.json | Package configuration with dependencies and build scripts |
| e2e-cli/package-lock.json | Lock file for deterministic dependency installation |
| e2e-cli/e2e-config.json | E2E test suite configuration |
| e2e-cli/build.js | esbuild configuration bundling CLI with SDK source and stubs |
| e2e-cli/README.md | Usage documentation and API specification |
| e2e-cli/.gitignore | Ignoring node_modules and dist directories |
| .github/workflows/e2e-tests.yml | GitHub Actions workflow for automated E2E testing |
| .eslintignore | Excluding e2e-cli from ESLint checks |
Files not reviewed (1)
- e2e-cli/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Update output examples to include sentBatches, add note explaining it's always 0 since the SDK doesn't expose batch count tracking. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix properties/traits validation to reject null and arrays - Use generic signature for Platform.select stub - Clarify logger and page→screen mapping with comments Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
No description provided.