Skip to content

Commit 2e00d7f

Browse files
abueideclaude
andauthored
chore: fix formatting in e2e-cli files to pass CI format-check (#1164)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1338bb2 commit 2e00d7f

4 files changed

Lines changed: 89 additions & 29 deletions

File tree

e2e-cli/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ node dist/cli.js --input '{"writeKey":"...", ...}'
2323

2424
```jsonc
2525
{
26-
"writeKey": "your-write-key", // required
27-
"apiHost": "https://...", // optional — SDK default if omitted
28-
"cdnHost": "https://...", // optional — SDK default if omitted
29-
"sequences": [ // required — event sequences to send
26+
"writeKey": "your-write-key", // required
27+
"apiHost": "https://...", // optional — SDK default if omitted
28+
"cdnHost": "https://...", // optional — SDK default if omitted
29+
"sequences": [
30+
// required — event sequences to send
3031
{
3132
"delayMs": 0,
32-
"events": [
33-
{ "type": "track", "event": "Test", "userId": "user-1" }
34-
]
33+
"events": [{ "type": "track", "event": "Test", "userId": "user-1" }]
3534
}
3635
],
37-
"config": { // optional
36+
"config": {
37+
// optional
3838
"flushAt": 20,
3939
"flushInterval": 30
4040
}

e2e-cli/run-e2e.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ if [ ! -d "$E2E_DIR" ]; then
3434
fi
3535
cd "$E2E_DIR"
3636
./scripts/run-tests.sh \
37-
--sdk-dir "$SCRIPT_DIR" \
38-
--cli "node $SCRIPT_DIR/dist/cli.js" \
39-
"$@"
37+
--sdk-dir "$SCRIPT_DIR" \
38+
--cli "node $SCRIPT_DIR/dist/cli.js" \
39+
"$@"

e2e-cli/src/cli.ts

Lines changed: 73 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,13 @@ async function main() {
9090
}
9191

9292
if (!inputStr) {
93-
console.log(JSON.stringify({ success: false, error: 'No input provided', sentBatches: 0 }));
93+
console.log(
94+
JSON.stringify({
95+
success: false,
96+
error: 'No input provided',
97+
sentBatches: 0,
98+
})
99+
);
94100
process.exit(1);
95101
}
96102

@@ -167,14 +173,24 @@ async function main() {
167173
case 'track': {
168174
// Required: event name
169175
if (!evt.event || typeof evt.event !== 'string') {
170-
console.warn(`[WARN] Skipping track event: missing or invalid event name`, evt);
176+
console.warn(
177+
`[WARN] Skipping track event: missing or invalid event name`,
178+
evt
179+
);
171180
continue;
172181
}
173182

174183
// Optional: properties (validate if present)
175184
const properties = evt.properties as JsonMap | undefined;
176-
if (evt.properties !== undefined && (evt.properties === null || Array.isArray(evt.properties) || typeof evt.properties !== 'object')) {
177-
console.warn(`[WARN] Track event "${evt.event}" has invalid properties, proceeding without them`);
185+
if (
186+
evt.properties !== undefined &&
187+
(evt.properties === null ||
188+
Array.isArray(evt.properties) ||
189+
typeof evt.properties !== 'object')
190+
) {
191+
console.warn(
192+
`[WARN] Track event "${evt.event}" has invalid properties, proceeding without them`
193+
);
178194
}
179195

180196
await client.track(evt.event, properties);
@@ -185,26 +201,44 @@ async function main() {
185201
// Optional userId (Segment allows anonymous identify)
186202
// Optional traits (validate if present)
187203
const traits = evt.traits as JsonMap | undefined;
188-
if (evt.traits !== undefined && (evt.traits === null || Array.isArray(evt.traits) || typeof evt.traits !== 'object')) {
189-
console.warn(`[WARN] Identify event has invalid traits, proceeding without them`);
204+
if (
205+
evt.traits !== undefined &&
206+
(evt.traits === null ||
207+
Array.isArray(evt.traits) ||
208+
typeof evt.traits !== 'object')
209+
) {
210+
console.warn(
211+
`[WARN] Identify event has invalid traits, proceeding without them`
212+
);
190213
}
191214

192215
await client.identify(evt.userId, traits);
193216
break;
194217
}
195218

196219
case 'screen':
197-
case 'page': { // RN SDK has no page(); map to screen for cross-SDK test compat
220+
case 'page': {
221+
// RN SDK has no page(); map to screen for cross-SDK test compat
198222
// Required: screen/page name
199223
if (!evt.name || typeof evt.name !== 'string') {
200-
console.warn(`[WARN] Skipping ${evt.type} event: missing or invalid name`, evt);
224+
console.warn(
225+
`[WARN] Skipping ${evt.type} event: missing or invalid name`,
226+
evt
227+
);
201228
continue;
202229
}
203230

204231
// Optional: properties (validate if present)
205232
const properties = evt.properties as JsonMap | undefined;
206-
if (evt.properties !== undefined && (evt.properties === null || Array.isArray(evt.properties) || typeof evt.properties !== 'object')) {
207-
console.warn(`[WARN] Screen "${evt.name}" has invalid properties, proceeding without them`);
233+
if (
234+
evt.properties !== undefined &&
235+
(evt.properties === null ||
236+
Array.isArray(evt.properties) ||
237+
typeof evt.properties !== 'object')
238+
) {
239+
console.warn(
240+
`[WARN] Screen "${evt.name}" has invalid properties, proceeding without them`
241+
);
208242
}
209243

210244
await client.screen(evt.name, properties);
@@ -214,14 +248,24 @@ async function main() {
214248
case 'group': {
215249
// Required: groupId
216250
if (!evt.groupId || typeof evt.groupId !== 'string') {
217-
console.warn(`[WARN] Skipping group event: missing or invalid groupId`, evt);
251+
console.warn(
252+
`[WARN] Skipping group event: missing or invalid groupId`,
253+
evt
254+
);
218255
continue;
219256
}
220257

221258
// Optional: traits (validate if present)
222259
const traits = evt.traits as JsonMap | undefined;
223-
if (evt.traits !== undefined && (evt.traits === null || Array.isArray(evt.traits) || typeof evt.traits !== 'object')) {
224-
console.warn(`[WARN] Group event for "${evt.groupId}" has invalid traits, proceeding without them`);
260+
if (
261+
evt.traits !== undefined &&
262+
(evt.traits === null ||
263+
Array.isArray(evt.traits) ||
264+
typeof evt.traits !== 'object')
265+
) {
266+
console.warn(
267+
`[WARN] Group event for "${evt.groupId}" has invalid traits, proceeding without them`
268+
);
225269
}
226270

227271
await client.group(evt.groupId, traits);
@@ -231,7 +275,10 @@ async function main() {
231275
case 'alias': {
232276
// Required: userId
233277
if (!evt.userId || typeof evt.userId !== 'string') {
234-
console.warn(`[WARN] Skipping alias event: missing or invalid userId`, evt);
278+
console.warn(
279+
`[WARN] Skipping alias event: missing or invalid userId`,
280+
evt
281+
);
235282
continue;
236283
}
237284

@@ -240,12 +287,19 @@ async function main() {
240287
}
241288

242289
default:
243-
console.warn(`[WARN] Skipping event: unknown event type "${evt.type}"`, evt);
290+
console.warn(
291+
`[WARN] Skipping event: unknown event type "${evt.type}"`,
292+
evt
293+
);
244294
continue;
245295
}
246296
} catch (error) {
247297
// Log but don't fail the entire sequence if one event fails
248-
console.error(`[ERROR] Failed to process ${evt.type} event:`, error, evt);
298+
console.error(
299+
`[ERROR] Failed to process ${evt.type} event:`,
300+
error,
301+
evt
302+
);
249303
continue;
250304
}
251305
}
@@ -270,6 +324,8 @@ async function main() {
270324
}
271325

272326
main().catch((e) => {
273-
console.log(JSON.stringify({ success: false, error: String(e), sentBatches: 0 }));
327+
console.log(
328+
JSON.stringify({ success: false, error: String(e), sentBatches: 0 })
329+
);
274330
process.exit(1);
275331
});

e2e-cli/src/stubs/sovran.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
*/
55

66
export { createStore } from '../../../packages/sovran/src/store';
7-
export type { Store, Notify, Unsubscribe } from '../../../packages/sovran/src/store';
7+
export type {
8+
Store,
9+
Notify,
10+
Unsubscribe,
11+
} from '../../../packages/sovran/src/store';
812
export { registerBridgeStore } from '../../../packages/sovran/src/bridge';
913
export type {
1014
Persistor,

0 commit comments

Comments
 (0)