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>
| break; | ||
| case 'screen': | ||
| await client.screen( | ||
| evt.event!, |
There was a problem hiding this comment.
also we should probably handle the cases where a field on event is missing instead of using null suppression ! operator. that way if some one passes an invalid event to --input, we don't get a vague runtime error
| break; | ||
| case 'group': | ||
| await client.group( | ||
| evt.event!, |
| Persistor, | ||
| PersistenceConfig, | ||
| } from '../../../packages/sovran/src/persistor/persistor'; | ||
| export { AsyncStoragePersistor } from '../../../packages/sovran/src/persistor/async-storage-persistor'; |
There was a problem hiding this comment.
exporting AsyncStoragePersistor will cause @react-native-async-storage/async-storage to be required which won't work with the CLI
| }; | ||
| } | ||
|
|
||
| interface CLIOutput { |
There was a problem hiding this comment.
in the e2e project we have sentBatches defined as a required parameter, but its not defined here in the cli tool. also it might be worth creating a library that exports common types used by both the client and server, but i'll leave that value judgement to you whether there are enough shared types to justify it.
| } | ||
|
|
||
| for (const evt of sequence.events) { | ||
| switch (evt.type) { |
| events: Array<{ | ||
| type: string; | ||
| event?: string; | ||
| userId?: string; |
There was a problem hiding this comment.
missing anonymousId, messageId, and timestamp.
| apiHost?: string; | ||
| cdnHost?: string; | ||
| sequences: Array<{ | ||
| delayMs: number; |
There was a problem hiding this comment.
i would separate the sequences and events into their own type like you did in the main repo
| }>; | ||
| }>; | ||
| config?: { | ||
| flushAt?: number; |
There was a problem hiding this comment.
same here i would split config into its own type, and add the missing maxRetries field
No description provided.