@datadog/mobile-react-native 1.5.2 → 1.7.0
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/DatadogSDKReactNative.podspec +2 -2
- package/android/build.gradle +2 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +4 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +6 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdLogs.kt +162 -6
- package/android/src/main/kotlin/com/datadog/reactnative/DdRum.kt +25 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +32 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +11 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +10 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdLogsTest.kt +242 -2
- package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +27 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +126 -30
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +19 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/GenericAssert.kt +2 -2
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +18 -1
- package/ios/Sources/Attributes.swift +7 -0
- package/ios/Sources/DdLogs.m +31 -0
- package/ios/Sources/DdLogs.swift +84 -4
- package/ios/Sources/DdRum.m +8 -0
- package/ios/Sources/DdRum.swift +17 -0
- package/ios/Sources/DdSdk.swift +40 -0
- package/ios/Sources/DdSdkConfiguration.swift +19 -1
- package/ios/Sources/RNDdSdkConfiguration.swift +11 -1
- package/lib/commonjs/DdSdkReactNative.js +6 -2
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +45 -2
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/InternalLog.js +6 -2
- package/lib/commonjs/InternalLog.js.map +1 -1
- package/lib/commonjs/errorUtils.js +20 -1
- package/lib/commonjs/errorUtils.js.map +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/logs/DdLogs.js +102 -11
- package/lib/commonjs/logs/DdLogs.js.map +1 -1
- package/lib/commonjs/logs/eventMapper.js.map +1 -1
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/rum/DdRum.js +14 -0
- package/lib/commonjs/rum/DdRum.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +62 -46
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +2 -2
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js +9 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js.map +1 -1
- package/lib/commonjs/rum/types.js.map +1 -1
- package/lib/commonjs/types.js +4 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNative.js +6 -2
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +42 -1
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/InternalLog.js +2 -1
- package/lib/module/InternalLog.js.map +1 -1
- package/lib/module/errorUtils.js +15 -0
- package/lib/module/errorUtils.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/logs/DdLogs.js +103 -12
- package/lib/module/logs/DdLogs.js.map +1 -1
- package/lib/module/logs/eventMapper.js.map +1 -1
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/rum/DdRum.js +12 -0
- package/lib/module/rum/DdRum.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +63 -46
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +2 -2
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js +9 -1
- package/lib/module/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js.map +1 -1
- package/lib/module/rum/types.js.map +1 -1
- package/lib/module/types.js +4 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +47 -0
- package/lib/typescript/InternalLog.d.ts +1 -0
- package/lib/typescript/errorUtils.d.ts +2 -0
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/logs/DdLogs.d.ts +13 -5
- package/lib/typescript/logs/eventMapper.d.ts +5 -5
- package/lib/typescript/logs/types.d.ts +34 -8
- package/lib/typescript/nativeModulesTypes.d.ts +51 -4
- package/lib/typescript/rum/DdRum.d.ts +2 -0
- package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts +3 -2
- package/lib/typescript/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.d.ts +5 -2
- package/lib/typescript/rum/types.d.ts +4 -0
- package/lib/typescript/types.d.ts +8 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/DdSdkReactNative.tsx +9 -1
- package/src/DdSdkReactNativeConfiguration.tsx +56 -1
- package/src/InternalLog.tsx +3 -1
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +20 -3
- package/src/__tests__/errorUtils.test.ts +49 -0
- package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +14 -14
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +474 -109
- package/src/__tests__/rum/instrumentation/ShallowObjectEqualityChecker.test.ts +18 -0
- package/src/errorUtils.ts +15 -0
- package/src/index.tsx +6 -2
- package/src/logs/DdLogs.ts +166 -16
- package/src/logs/__tests__/DdLogs.test.ts +169 -0
- package/src/logs/__tests__/eventMapper.test.ts +34 -0
- package/src/logs/eventMapper.ts +15 -4
- package/src/logs/types.ts +36 -8
- package/src/nativeModulesTypes.ts +81 -4
- package/src/rum/DdRum.ts +17 -0
- package/src/rum/__tests__/DdRum.test.ts +12 -27
- package/src/rum/instrumentation/DdRumErrorTracking.tsx +44 -10
- package/src/rum/instrumentation/interactionTracking/DdEventsInterceptor.tsx +7 -4
- package/src/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.ts +11 -3
- package/src/rum/types.ts +5 -0
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +5 -0
- package/src/types.tsx +5 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { getErrorName } from '../errorUtils';
|
|
8
|
+
|
|
9
|
+
describe('errorUtils', () => {
|
|
10
|
+
describe('getErrorName', () => {
|
|
11
|
+
it('returns the error.name if defined', () => {
|
|
12
|
+
let error;
|
|
13
|
+
try {
|
|
14
|
+
// eslint-disable-next-line no-unused-expressions
|
|
15
|
+
error.bad.property;
|
|
16
|
+
} catch (e) {
|
|
17
|
+
// error will be a TypeError
|
|
18
|
+
error = e;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
expect(getErrorName(error)).toBe('TypeError');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('returns the error.name if defined by an extension', () => {
|
|
25
|
+
class CustomError extends Error {
|
|
26
|
+
name = 'CustomError';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const error = new CustomError('some custom error');
|
|
30
|
+
expect(getErrorName(error)).toBe('CustomError');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('returns "Error" for an Error object', () => {
|
|
34
|
+
const error = new Error('some error');
|
|
35
|
+
expect(getErrorName(error)).toBe('Error');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('returns "Error" for an object without a name property', () => {
|
|
39
|
+
const error = { message: 'some error' };
|
|
40
|
+
expect(getErrorName(error)).toBe('Error');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('returns "Error" for an non object types', () => {
|
|
44
|
+
expect(getErrorName(undefined)).toBe('Error');
|
|
45
|
+
expect(getErrorName(null)).toBe('Error');
|
|
46
|
+
expect(getErrorName('some error')).toBe('Error');
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -186,9 +186,9 @@ it('M do nothing W interceptOnPress { invalid arguments - empty object } ', asyn
|
|
|
186
186
|
expect(DdRum.addAction.mock.calls.length).toBe(0);
|
|
187
187
|
expect(InternalLog.log.mock.calls.length).toBe(1);
|
|
188
188
|
expect(InternalLog.log.mock.calls[0][0]).toBe(
|
|
189
|
-
DdEventsInterceptor.
|
|
189
|
+
DdEventsInterceptor.ACTION_EVENT_DROPPED_DEBUG_MESSAGE
|
|
190
190
|
);
|
|
191
|
-
expect(InternalLog.log.mock.calls[0][1]).toBe(SdkVerbosity.
|
|
191
|
+
expect(InternalLog.log.mock.calls[0][1]).toBe(SdkVerbosity.DEBUG);
|
|
192
192
|
});
|
|
193
193
|
|
|
194
194
|
it('M do nothing W interceptOnPress { invalid arguments - array } ', async () => {
|
|
@@ -202,9 +202,9 @@ it('M do nothing W interceptOnPress { invalid arguments - array } ', async () =>
|
|
|
202
202
|
expect(DdRum.addAction.mock.calls.length).toBe(0);
|
|
203
203
|
expect(InternalLog.log.mock.calls.length).toBe(1);
|
|
204
204
|
expect(InternalLog.log.mock.calls[0][0]).toBe(
|
|
205
|
-
DdEventsInterceptor.
|
|
205
|
+
DdEventsInterceptor.ACTION_EVENT_DROPPED_DEBUG_MESSAGE
|
|
206
206
|
);
|
|
207
|
-
expect(InternalLog.log.mock.calls[0][1]).toBe(SdkVerbosity.
|
|
207
|
+
expect(InternalLog.log.mock.calls[0][1]).toBe(SdkVerbosity.DEBUG);
|
|
208
208
|
});
|
|
209
209
|
|
|
210
210
|
it('M do nothing W interceptOnPress { invalid arguments - nested array } ', async () => {
|
|
@@ -218,9 +218,9 @@ it('M do nothing W interceptOnPress { invalid arguments - nested array } ', asyn
|
|
|
218
218
|
expect(DdRum.addAction.mock.calls.length).toBe(0);
|
|
219
219
|
expect(InternalLog.log.mock.calls.length).toBe(1);
|
|
220
220
|
expect(InternalLog.log.mock.calls[0][0]).toBe(
|
|
221
|
-
DdEventsInterceptor.
|
|
221
|
+
DdEventsInterceptor.ACTION_EVENT_DROPPED_DEBUG_MESSAGE
|
|
222
222
|
);
|
|
223
|
-
expect(InternalLog.log.mock.calls[0][1]).toBe(SdkVerbosity.
|
|
223
|
+
expect(InternalLog.log.mock.calls[0][1]).toBe(SdkVerbosity.DEBUG);
|
|
224
224
|
});
|
|
225
225
|
|
|
226
226
|
it('M do nothing W interceptOnPress { invalid arguments - undefined } ', async () => {
|
|
@@ -234,9 +234,9 @@ it('M do nothing W interceptOnPress { invalid arguments - undefined } ', async (
|
|
|
234
234
|
expect(DdRum.addAction.mock.calls.length).toBe(0);
|
|
235
235
|
expect(InternalLog.log.mock.calls.length).toBe(1);
|
|
236
236
|
expect(InternalLog.log.mock.calls[0][0]).toBe(
|
|
237
|
-
DdEventsInterceptor.
|
|
237
|
+
DdEventsInterceptor.ACTION_EVENT_DROPPED_DEBUG_MESSAGE
|
|
238
238
|
);
|
|
239
|
-
expect(InternalLog.log.mock.calls[0][1]).toBe(SdkVerbosity.
|
|
239
|
+
expect(InternalLog.log.mock.calls[0][1]).toBe(SdkVerbosity.DEBUG);
|
|
240
240
|
});
|
|
241
241
|
|
|
242
242
|
it('M do nothing W interceptOnPress { invalid arguments - null } ', async () => {
|
|
@@ -250,9 +250,9 @@ it('M do nothing W interceptOnPress { invalid arguments - null } ', async () =>
|
|
|
250
250
|
expect(DdRum.addAction.mock.calls.length).toBe(0);
|
|
251
251
|
expect(InternalLog.log.mock.calls.length).toBe(1);
|
|
252
252
|
expect(InternalLog.log.mock.calls[0][0]).toBe(
|
|
253
|
-
DdEventsInterceptor.
|
|
253
|
+
DdEventsInterceptor.ACTION_EVENT_DROPPED_DEBUG_MESSAGE
|
|
254
254
|
);
|
|
255
|
-
expect(InternalLog.log.mock.calls[0][1]).toBe(SdkVerbosity.
|
|
255
|
+
expect(InternalLog.log.mock.calls[0][1]).toBe(SdkVerbosity.DEBUG);
|
|
256
256
|
});
|
|
257
257
|
|
|
258
258
|
it('M do nothing W interceptOnPress { invalid arguments - wrong object } ', async () => {
|
|
@@ -263,9 +263,9 @@ it('M do nothing W interceptOnPress { invalid arguments - wrong object } ', asyn
|
|
|
263
263
|
expect(DdRum.addAction.mock.calls.length).toBe(0);
|
|
264
264
|
expect(InternalLog.log.mock.calls.length).toBe(1);
|
|
265
265
|
expect(InternalLog.log.mock.calls[0][0]).toBe(
|
|
266
|
-
DdEventsInterceptor.
|
|
266
|
+
DdEventsInterceptor.ACTION_EVENT_DROPPED_DEBUG_MESSAGE
|
|
267
267
|
);
|
|
268
|
-
expect(InternalLog.log.mock.calls[0][1]).toBe(SdkVerbosity.
|
|
268
|
+
expect(InternalLog.log.mock.calls[0][1]).toBe(SdkVerbosity.DEBUG);
|
|
269
269
|
});
|
|
270
270
|
|
|
271
271
|
it('M do nothing W interceptOnPress { no arguments call } ', async () => {
|
|
@@ -276,7 +276,7 @@ it('M do nothing W interceptOnPress { no arguments call } ', async () => {
|
|
|
276
276
|
expect(DdRum.addAction.mock.calls.length).toBe(0);
|
|
277
277
|
expect(InternalLog.log.mock.calls.length).toBe(1);
|
|
278
278
|
expect(InternalLog.log.mock.calls[0][0]).toBe(
|
|
279
|
-
DdEventsInterceptor.
|
|
279
|
+
DdEventsInterceptor.ACTION_EVENT_DROPPED_DEBUG_MESSAGE
|
|
280
280
|
);
|
|
281
|
-
expect(InternalLog.log.mock.calls[0][1]).toBe(SdkVerbosity.
|
|
281
|
+
expect(InternalLog.log.mock.calls[0][1]).toBe(SdkVerbosity.DEBUG);
|
|
282
282
|
});
|