@datadog/mobile-react-native 2.3.5 → 2.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/datadog-sourcemaps.gradle +64 -1
- package/ios/Sources/SdkVersion.swift +1 -1
- package/lib/commonjs/logs/DdLogs.js +10 -8
- package/lib/commonjs/logs/DdLogs.js.map +1 -1
- package/lib/commonjs/rum/DdRum.js +50 -48
- package/lib/commonjs/rum/DdRum.js.map +1 -1
- package/lib/commonjs/trace/DdTrace.js +4 -2
- package/lib/commonjs/trace/DdTrace.js.map +1 -1
- package/lib/commonjs/utils/argsUtils.js +43 -0
- package/lib/commonjs/utils/argsUtils.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/logs/DdLogs.js +9 -8
- package/lib/module/logs/DdLogs.js.map +1 -1
- package/lib/module/rum/DdRum.js +48 -47
- package/lib/module/rum/DdRum.js.map +1 -1
- package/lib/module/trace/DdTrace.js +3 -2
- package/lib/module/trace/DdTrace.js.map +1 -1
- package/lib/module/utils/argsUtils.js +30 -0
- package/lib/module/utils/argsUtils.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/rum/DdRum.d.ts +2 -2
- package/lib/typescript/utils/argsUtils.d.ts +1 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/logs/DdLogs.ts +9 -8
- package/src/logs/__tests__/DdLogs.test.ts +543 -0
- package/src/rum/DdRum.ts +112 -94
- package/src/rum/__tests__/DdRum.test.ts +552 -0
- package/src/trace/DdTrace.ts +12 -2
- package/src/trace/__tests__/DdTrace.test.ts +146 -0
- package/src/utils/__tests__/argsUtils.test.ts +66 -0
- package/src/utils/argsUtils.ts +35 -0
- package/src/version.ts +1 -1
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { NativeModules } from 'react-native';
|
|
8
8
|
|
|
9
9
|
import { InternalLog } from '../../InternalLog';
|
|
10
|
+
import { SdkVerbosity } from '../../SdkVerbosity';
|
|
10
11
|
import type { DdNativeLogsType } from '../../nativeModulesTypes';
|
|
11
12
|
import { DdLogs } from '../DdLogs';
|
|
12
13
|
import type { LogEventMapper } from '../types';
|
|
@@ -217,4 +218,546 @@ describe('DdLogs', () => {
|
|
|
217
218
|
);
|
|
218
219
|
});
|
|
219
220
|
});
|
|
221
|
+
|
|
222
|
+
describe('log context', () => {
|
|
223
|
+
beforeEach(() => {
|
|
224
|
+
jest.clearAllMocks();
|
|
225
|
+
DdLogs.unregisterLogEventMapper();
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
describe('debug logs', () => {
|
|
229
|
+
it('native context is empty W context is undefined', async () => {
|
|
230
|
+
await DdLogs.debug('message', undefined);
|
|
231
|
+
expect(NativeModules.DdLogs.debug).toHaveBeenCalledWith(
|
|
232
|
+
'message',
|
|
233
|
+
{}
|
|
234
|
+
);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it('native context is an object with nested property W context is an array', async () => {
|
|
238
|
+
await DdLogs.debug('message', [1, 2, 3]);
|
|
239
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
240
|
+
1,
|
|
241
|
+
expect.anything(),
|
|
242
|
+
SdkVerbosity.WARN
|
|
243
|
+
);
|
|
244
|
+
expect(
|
|
245
|
+
NativeModules.DdLogs.debug
|
|
246
|
+
).toHaveBeenCalledWith('message', { context: [1, 2, 3] });
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it('native context is empty W context is raw type', async () => {
|
|
250
|
+
const obj: any = 123;
|
|
251
|
+
await DdLogs.debug('message', obj);
|
|
252
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
253
|
+
1,
|
|
254
|
+
expect.anything(),
|
|
255
|
+
SdkVerbosity.ERROR
|
|
256
|
+
);
|
|
257
|
+
expect(NativeModules.DdLogs.debug).toHaveBeenCalledWith(
|
|
258
|
+
'message',
|
|
259
|
+
{}
|
|
260
|
+
);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it('native context is unmodified W context is a valid object', async () => {
|
|
264
|
+
await DdLogs.debug('message', { test: '123' });
|
|
265
|
+
expect(
|
|
266
|
+
NativeModules.DdLogs.debug
|
|
267
|
+
).toHaveBeenCalledWith('message', { test: '123' });
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
describe('warn logs', () => {
|
|
272
|
+
it('native context is empty W context is undefined', async () => {
|
|
273
|
+
await DdLogs.warn('message', undefined);
|
|
274
|
+
expect(NativeModules.DdLogs.warn).toHaveBeenCalledWith(
|
|
275
|
+
'message',
|
|
276
|
+
{}
|
|
277
|
+
);
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
it('native context is an object with nested property W context is an array', async () => {
|
|
281
|
+
await DdLogs.warn('message', [1, 2, 3]);
|
|
282
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
283
|
+
1,
|
|
284
|
+
expect.anything(),
|
|
285
|
+
SdkVerbosity.WARN
|
|
286
|
+
);
|
|
287
|
+
expect(
|
|
288
|
+
NativeModules.DdLogs.warn
|
|
289
|
+
).toHaveBeenCalledWith('message', { context: [1, 2, 3] });
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
it('native context is empty W context is raw type', async () => {
|
|
293
|
+
const obj: any = 123;
|
|
294
|
+
await DdLogs.warn('message', obj);
|
|
295
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
296
|
+
1,
|
|
297
|
+
expect.anything(),
|
|
298
|
+
SdkVerbosity.ERROR
|
|
299
|
+
);
|
|
300
|
+
expect(NativeModules.DdLogs.warn).toHaveBeenCalledWith(
|
|
301
|
+
'message',
|
|
302
|
+
{}
|
|
303
|
+
);
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
it('native context is unmodified W context is a valid object', async () => {
|
|
307
|
+
await DdLogs.warn('message', { test: '123' });
|
|
308
|
+
expect(
|
|
309
|
+
NativeModules.DdLogs.warn
|
|
310
|
+
).toHaveBeenCalledWith('message', { test: '123' });
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
describe('info logs', () => {
|
|
315
|
+
it('native context is empty W context is undefined', async () => {
|
|
316
|
+
await DdLogs.info('message', undefined);
|
|
317
|
+
expect(NativeModules.DdLogs.info).toHaveBeenCalledWith(
|
|
318
|
+
'message',
|
|
319
|
+
{}
|
|
320
|
+
);
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
it('native context is an object with nested property W context is an array', async () => {
|
|
324
|
+
await DdLogs.info('message', [1, 2, 3]);
|
|
325
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
326
|
+
1,
|
|
327
|
+
expect.anything(),
|
|
328
|
+
SdkVerbosity.WARN
|
|
329
|
+
);
|
|
330
|
+
expect(
|
|
331
|
+
NativeModules.DdLogs.info
|
|
332
|
+
).toHaveBeenCalledWith('message', { context: [1, 2, 3] });
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
it('native context is empty W context is raw type', async () => {
|
|
336
|
+
const obj: any = 123;
|
|
337
|
+
await DdLogs.info('message', obj);
|
|
338
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
339
|
+
1,
|
|
340
|
+
expect.anything(),
|
|
341
|
+
SdkVerbosity.ERROR
|
|
342
|
+
);
|
|
343
|
+
expect(NativeModules.DdLogs.info).toHaveBeenCalledWith(
|
|
344
|
+
'message',
|
|
345
|
+
{}
|
|
346
|
+
);
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
it('native context is unmodified W context is a valid object', async () => {
|
|
350
|
+
await DdLogs.info('message', { test: '123' });
|
|
351
|
+
expect(
|
|
352
|
+
NativeModules.DdLogs.info
|
|
353
|
+
).toHaveBeenCalledWith('message', { test: '123' });
|
|
354
|
+
});
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
describe('error logs', () => {
|
|
358
|
+
it('native context is empty W context is undefined', async () => {
|
|
359
|
+
await DdLogs.error('message', undefined);
|
|
360
|
+
expect(NativeModules.DdLogs.error).toHaveBeenCalledWith(
|
|
361
|
+
'message',
|
|
362
|
+
{}
|
|
363
|
+
);
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
it('native context is an object with nested property W context is an array', async () => {
|
|
367
|
+
await DdLogs.error('message', [1, 2, 3]);
|
|
368
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
369
|
+
1,
|
|
370
|
+
expect.anything(),
|
|
371
|
+
SdkVerbosity.WARN
|
|
372
|
+
);
|
|
373
|
+
expect(
|
|
374
|
+
NativeModules.DdLogs.error
|
|
375
|
+
).toHaveBeenCalledWith('message', { context: [1, 2, 3] });
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
it('native context is empty W context is raw type', async () => {
|
|
379
|
+
const obj: any = 123;
|
|
380
|
+
await DdLogs.error('message', obj);
|
|
381
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
382
|
+
1,
|
|
383
|
+
expect.anything(),
|
|
384
|
+
SdkVerbosity.ERROR
|
|
385
|
+
);
|
|
386
|
+
expect(NativeModules.DdLogs.error).toHaveBeenCalledWith(
|
|
387
|
+
'message',
|
|
388
|
+
{}
|
|
389
|
+
);
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
it('native context is unmodified W context is a valid object', async () => {
|
|
393
|
+
await DdLogs.error('message', { test: '123' });
|
|
394
|
+
expect(
|
|
395
|
+
NativeModules.DdLogs.error
|
|
396
|
+
).toHaveBeenCalledWith('message', { test: '123' });
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
describe('log with error context', () => {
|
|
402
|
+
beforeEach(() => {
|
|
403
|
+
jest.clearAllMocks();
|
|
404
|
+
DdLogs.unregisterLogEventMapper();
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
describe('debug logs', () => {
|
|
408
|
+
it('native context is empty W context is undefined', async () => {
|
|
409
|
+
await DdLogs.debug(
|
|
410
|
+
'message',
|
|
411
|
+
'kind',
|
|
412
|
+
'message',
|
|
413
|
+
'stacktrace',
|
|
414
|
+
undefined
|
|
415
|
+
);
|
|
416
|
+
expect(
|
|
417
|
+
NativeModules.DdLogs.debugWithError
|
|
418
|
+
).toHaveBeenCalledWith(
|
|
419
|
+
'message',
|
|
420
|
+
'kind',
|
|
421
|
+
'message',
|
|
422
|
+
'stacktrace',
|
|
423
|
+
{ '_dd.error.source_type': 'react-native' }
|
|
424
|
+
);
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
it('native context is an object with nested property W context is an array', async () => {
|
|
428
|
+
await DdLogs.debug('message', 'kind', 'message', 'stacktrace', [
|
|
429
|
+
1,
|
|
430
|
+
2,
|
|
431
|
+
3
|
|
432
|
+
]);
|
|
433
|
+
|
|
434
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
435
|
+
1,
|
|
436
|
+
expect.anything(),
|
|
437
|
+
SdkVerbosity.WARN
|
|
438
|
+
);
|
|
439
|
+
|
|
440
|
+
expect(
|
|
441
|
+
NativeModules.DdLogs.debugWithError
|
|
442
|
+
).toHaveBeenCalledWith(
|
|
443
|
+
'message',
|
|
444
|
+
'kind',
|
|
445
|
+
'message',
|
|
446
|
+
'stacktrace',
|
|
447
|
+
{
|
|
448
|
+
context: [1, 2, 3],
|
|
449
|
+
'_dd.error.source_type': 'react-native'
|
|
450
|
+
}
|
|
451
|
+
);
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
it('native context is empty W context is raw type', async () => {
|
|
455
|
+
const obj: any = 123;
|
|
456
|
+
await DdLogs.debug(
|
|
457
|
+
'message',
|
|
458
|
+
'kind',
|
|
459
|
+
'message',
|
|
460
|
+
'stacktrace',
|
|
461
|
+
obj
|
|
462
|
+
);
|
|
463
|
+
|
|
464
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
465
|
+
1,
|
|
466
|
+
expect.anything(),
|
|
467
|
+
SdkVerbosity.ERROR
|
|
468
|
+
);
|
|
469
|
+
|
|
470
|
+
expect(
|
|
471
|
+
NativeModules.DdLogs.debugWithError
|
|
472
|
+
).toHaveBeenCalledWith(
|
|
473
|
+
'message',
|
|
474
|
+
'kind',
|
|
475
|
+
'message',
|
|
476
|
+
'stacktrace',
|
|
477
|
+
{ '_dd.error.source_type': 'react-native' }
|
|
478
|
+
);
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
it('native context is unmodified W context is a valid object', async () => {
|
|
482
|
+
await DdLogs.debug('message', 'kind', 'message', 'stacktrace', {
|
|
483
|
+
test: '123'
|
|
484
|
+
});
|
|
485
|
+
expect(
|
|
486
|
+
NativeModules.DdLogs.debugWithError
|
|
487
|
+
).toHaveBeenCalledWith(
|
|
488
|
+
'message',
|
|
489
|
+
'kind',
|
|
490
|
+
'message',
|
|
491
|
+
'stacktrace',
|
|
492
|
+
{ test: '123', '_dd.error.source_type': 'react-native' }
|
|
493
|
+
);
|
|
494
|
+
});
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
describe('warn logs', () => {
|
|
498
|
+
it('native context is empty W context is undefined', async () => {
|
|
499
|
+
await DdLogs.warn(
|
|
500
|
+
'message',
|
|
501
|
+
'kind',
|
|
502
|
+
'message',
|
|
503
|
+
'stacktrace',
|
|
504
|
+
undefined
|
|
505
|
+
);
|
|
506
|
+
expect(
|
|
507
|
+
NativeModules.DdLogs.warnWithError
|
|
508
|
+
).toHaveBeenCalledWith(
|
|
509
|
+
'message',
|
|
510
|
+
'kind',
|
|
511
|
+
'message',
|
|
512
|
+
'stacktrace',
|
|
513
|
+
{ '_dd.error.source_type': 'react-native' }
|
|
514
|
+
);
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
it('native context is an object with nested property W context is an array', async () => {
|
|
518
|
+
await DdLogs.warn('message', 'kind', 'message', 'stacktrace', [
|
|
519
|
+
1,
|
|
520
|
+
2,
|
|
521
|
+
3
|
|
522
|
+
]);
|
|
523
|
+
|
|
524
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
525
|
+
1,
|
|
526
|
+
expect.anything(),
|
|
527
|
+
SdkVerbosity.WARN
|
|
528
|
+
);
|
|
529
|
+
|
|
530
|
+
expect(NativeModules.DdLogs.warnWithError).toHaveBeenCalledWith(
|
|
531
|
+
'message',
|
|
532
|
+
'kind',
|
|
533
|
+
'message',
|
|
534
|
+
'stacktrace',
|
|
535
|
+
{
|
|
536
|
+
context: [1, 2, 3],
|
|
537
|
+
'_dd.error.source_type': 'react-native'
|
|
538
|
+
}
|
|
539
|
+
);
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
it('native context is empty W context is raw type', async () => {
|
|
543
|
+
const obj: any = 123;
|
|
544
|
+
await DdLogs.warn(
|
|
545
|
+
'message',
|
|
546
|
+
'kind',
|
|
547
|
+
'message',
|
|
548
|
+
'stacktrace',
|
|
549
|
+
obj
|
|
550
|
+
);
|
|
551
|
+
|
|
552
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
553
|
+
1,
|
|
554
|
+
expect.anything(),
|
|
555
|
+
SdkVerbosity.ERROR
|
|
556
|
+
);
|
|
557
|
+
|
|
558
|
+
expect(
|
|
559
|
+
NativeModules.DdLogs.warnWithError
|
|
560
|
+
).toHaveBeenCalledWith(
|
|
561
|
+
'message',
|
|
562
|
+
'kind',
|
|
563
|
+
'message',
|
|
564
|
+
'stacktrace',
|
|
565
|
+
{ '_dd.error.source_type': 'react-native' }
|
|
566
|
+
);
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
it('native context is unmodified W context is a valid object', async () => {
|
|
570
|
+
await DdLogs.warn('message', 'kind', 'message', 'stacktrace', {
|
|
571
|
+
test: '123'
|
|
572
|
+
});
|
|
573
|
+
expect(
|
|
574
|
+
NativeModules.DdLogs.warnWithError
|
|
575
|
+
).toHaveBeenCalledWith(
|
|
576
|
+
'message',
|
|
577
|
+
'kind',
|
|
578
|
+
'message',
|
|
579
|
+
'stacktrace',
|
|
580
|
+
{ test: '123', '_dd.error.source_type': 'react-native' }
|
|
581
|
+
);
|
|
582
|
+
});
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
describe('info logs', () => {
|
|
586
|
+
it('native context is empty W context is undefined', async () => {
|
|
587
|
+
await DdLogs.info(
|
|
588
|
+
'message',
|
|
589
|
+
'kind',
|
|
590
|
+
'message',
|
|
591
|
+
'stacktrace',
|
|
592
|
+
undefined
|
|
593
|
+
);
|
|
594
|
+
expect(
|
|
595
|
+
NativeModules.DdLogs.infoWithError
|
|
596
|
+
).toHaveBeenCalledWith(
|
|
597
|
+
'message',
|
|
598
|
+
'kind',
|
|
599
|
+
'message',
|
|
600
|
+
'stacktrace',
|
|
601
|
+
{ '_dd.error.source_type': 'react-native' }
|
|
602
|
+
);
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
it('native context is an object with nested property W context is an array', async () => {
|
|
606
|
+
await DdLogs.info('message', 'kind', 'message', 'stacktrace', [
|
|
607
|
+
1,
|
|
608
|
+
2,
|
|
609
|
+
3
|
|
610
|
+
]);
|
|
611
|
+
|
|
612
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
613
|
+
1,
|
|
614
|
+
expect.anything(),
|
|
615
|
+
SdkVerbosity.WARN
|
|
616
|
+
);
|
|
617
|
+
|
|
618
|
+
expect(NativeModules.DdLogs.infoWithError).toHaveBeenCalledWith(
|
|
619
|
+
'message',
|
|
620
|
+
'kind',
|
|
621
|
+
'message',
|
|
622
|
+
'stacktrace',
|
|
623
|
+
{
|
|
624
|
+
context: [1, 2, 3],
|
|
625
|
+
'_dd.error.source_type': 'react-native'
|
|
626
|
+
}
|
|
627
|
+
);
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
it('native context is empty W context is raw type', async () => {
|
|
631
|
+
const obj: any = 123;
|
|
632
|
+
await DdLogs.info(
|
|
633
|
+
'message',
|
|
634
|
+
'kind',
|
|
635
|
+
'message',
|
|
636
|
+
'stacktrace',
|
|
637
|
+
obj
|
|
638
|
+
);
|
|
639
|
+
|
|
640
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
641
|
+
1,
|
|
642
|
+
expect.anything(),
|
|
643
|
+
SdkVerbosity.ERROR
|
|
644
|
+
);
|
|
645
|
+
|
|
646
|
+
expect(
|
|
647
|
+
NativeModules.DdLogs.infoWithError
|
|
648
|
+
).toHaveBeenCalledWith(
|
|
649
|
+
'message',
|
|
650
|
+
'kind',
|
|
651
|
+
'message',
|
|
652
|
+
'stacktrace',
|
|
653
|
+
{ '_dd.error.source_type': 'react-native' }
|
|
654
|
+
);
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
it('native context is unmodified W context is a valid object', async () => {
|
|
658
|
+
await DdLogs.info('message', 'kind', 'message', 'stacktrace', {
|
|
659
|
+
test: '123'
|
|
660
|
+
});
|
|
661
|
+
expect(
|
|
662
|
+
NativeModules.DdLogs.infoWithError
|
|
663
|
+
).toHaveBeenCalledWith(
|
|
664
|
+
'message',
|
|
665
|
+
'kind',
|
|
666
|
+
'message',
|
|
667
|
+
'stacktrace',
|
|
668
|
+
{ test: '123', '_dd.error.source_type': 'react-native' }
|
|
669
|
+
);
|
|
670
|
+
});
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
describe('error logs', () => {
|
|
674
|
+
it('native context is empty W context is undefined', async () => {
|
|
675
|
+
await DdLogs.error(
|
|
676
|
+
'message',
|
|
677
|
+
'kind',
|
|
678
|
+
'message',
|
|
679
|
+
'stacktrace',
|
|
680
|
+
undefined
|
|
681
|
+
);
|
|
682
|
+
expect(
|
|
683
|
+
NativeModules.DdLogs.errorWithError
|
|
684
|
+
).toHaveBeenCalledWith(
|
|
685
|
+
'message',
|
|
686
|
+
'kind',
|
|
687
|
+
'message',
|
|
688
|
+
'stacktrace',
|
|
689
|
+
{ '_dd.error.source_type': 'react-native' }
|
|
690
|
+
);
|
|
691
|
+
});
|
|
692
|
+
|
|
693
|
+
it('native context is an object with nested property W context is an array', async () => {
|
|
694
|
+
await DdLogs.error('message', 'kind', 'message', 'stacktrace', [
|
|
695
|
+
1,
|
|
696
|
+
2,
|
|
697
|
+
3
|
|
698
|
+
]);
|
|
699
|
+
|
|
700
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
701
|
+
1,
|
|
702
|
+
expect.anything(),
|
|
703
|
+
SdkVerbosity.WARN
|
|
704
|
+
);
|
|
705
|
+
|
|
706
|
+
expect(
|
|
707
|
+
NativeModules.DdLogs.errorWithError
|
|
708
|
+
).toHaveBeenCalledWith(
|
|
709
|
+
'message',
|
|
710
|
+
'kind',
|
|
711
|
+
'message',
|
|
712
|
+
'stacktrace',
|
|
713
|
+
{
|
|
714
|
+
context: [1, 2, 3],
|
|
715
|
+
'_dd.error.source_type': 'react-native'
|
|
716
|
+
}
|
|
717
|
+
);
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
it('native context is empty W context is raw type', async () => {
|
|
721
|
+
const obj: any = 123;
|
|
722
|
+
await DdLogs.error(
|
|
723
|
+
'message',
|
|
724
|
+
'kind',
|
|
725
|
+
'message',
|
|
726
|
+
'stacktrace',
|
|
727
|
+
obj
|
|
728
|
+
);
|
|
729
|
+
|
|
730
|
+
expect(InternalLog.log).toHaveBeenNthCalledWith(
|
|
731
|
+
1,
|
|
732
|
+
expect.anything(),
|
|
733
|
+
SdkVerbosity.ERROR
|
|
734
|
+
);
|
|
735
|
+
|
|
736
|
+
expect(
|
|
737
|
+
NativeModules.DdLogs.errorWithError
|
|
738
|
+
).toHaveBeenCalledWith(
|
|
739
|
+
'message',
|
|
740
|
+
'kind',
|
|
741
|
+
'message',
|
|
742
|
+
'stacktrace',
|
|
743
|
+
{ '_dd.error.source_type': 'react-native' }
|
|
744
|
+
);
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
it('native context is unmodified W context is a valid object', async () => {
|
|
748
|
+
await DdLogs.error('message', 'kind', 'message', 'stacktrace', {
|
|
749
|
+
test: '123'
|
|
750
|
+
});
|
|
751
|
+
expect(
|
|
752
|
+
NativeModules.DdLogs.errorWithError
|
|
753
|
+
).toHaveBeenCalledWith(
|
|
754
|
+
'message',
|
|
755
|
+
'kind',
|
|
756
|
+
'message',
|
|
757
|
+
'stacktrace',
|
|
758
|
+
{ test: '123', '_dd.error.source_type': 'react-native' }
|
|
759
|
+
);
|
|
760
|
+
});
|
|
761
|
+
});
|
|
762
|
+
});
|
|
220
763
|
});
|