Skip to content

Commit 36acf23

Browse files
Merge branch 'main' 4.13.0 into 5.0.0
2 parents 5bb8026 + 4592fb8 commit 36acf23

File tree

5 files changed

+136
-109
lines changed

5 files changed

+136
-109
lines changed

CHANGELOG.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Unreleased
44

5-
- Latest changes from 4.12.0
5+
- Latest changes from 4.13.0
66

77
### Breaking changes
88

@@ -12,6 +12,11 @@
1212
### Fixes
1313

1414
- Unreachable fallback to fetch transport if native is not available ([#2695](https://github.com/getsentry/sentry-react-native/pull/2695))
15+
16+
## 4.13.0
17+
18+
### Fixes
19+
1520
- Missing `originalException` in `beforeSend` for events from react native error handler ([#2706](https://github.com/getsentry/sentry-react-native/pull/2706))
1621
- ModulesLoader integration returns original event if native is not available and event modules overwrite native modules ([#2730](https://github.com/getsentry/sentry-react-native/pull/2730))
1722

@@ -20,9 +25,9 @@
2025
- Bump Cocoa SDK from v7.31.3 to v7.31.5 ([#2699](https://github.com/getsentry/sentry-react-native/pull/2699), [#2714](https://github.com/getsentry/sentry-react-native/pull/2714))
2126
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/8.0.0/CHANGELOG.md#7315)
2227
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.31.3...7.31.5)
23-
- Bump JavaScript SDK from v7.26.0 to v7.28.1 ([#2705](https://github.com/getsentry/sentry-react-native/pull/2705), [#2709](https://github.com/getsentry/sentry-react-native/pull/2709), [#2715](https://github.com/getsentry/sentry-react-native/pull/2715))
24-
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7281)
25-
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.26.0...7.28.1)
28+
- Bump JavaScript SDK from v7.26.0 to v7.29.0 ([#2705](https://github.com/getsentry/sentry-react-native/pull/2705), [#2709](https://github.com/getsentry/sentry-react-native/pull/2709), [#2715](https://github.com/getsentry/sentry-react-native/pull/2715), [#2736](https://github.com/getsentry/sentry-react-native/pull/2736))
29+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7290)
30+
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.26.0...7.29.0)
2631
- Bump Android SDK from v6.9.2 to v6.11.0 ([#2704](https://github.com/getsentry/sentry-react-native/pull/2704), [#2724](https://github.com/getsentry/sentry-react-native/pull/2724))
2732
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6110)
2833
- [diff](https://github.com/getsentry/sentry-java/compare/6.9.2...6.11.0)

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@
4242
"react-native": ">=0.65.0"
4343
},
4444
"dependencies": {
45-
"@sentry/browser": "7.28.1",
45+
"@sentry/browser": "7.29.0",
4646
"@sentry/cli": "2.10.0",
47-
"@sentry/core": "7.28.1",
48-
"@sentry/hub": "7.28.1",
49-
"@sentry/integrations": "7.28.1",
50-
"@sentry/react": "7.28.1",
51-
"@sentry/tracing": "7.28.1",
52-
"@sentry/types": "7.28.1",
53-
"@sentry/utils": "7.28.1"
47+
"@sentry/core": "7.29.0",
48+
"@sentry/hub": "7.29.0",
49+
"@sentry/integrations": "7.29.0",
50+
"@sentry/react": "7.29.0",
51+
"@sentry/tracing": "7.29.0",
52+
"@sentry/types": "7.29.0",
53+
"@sentry/utils": "7.29.0"
5454
},
5555
"devDependencies": {
56-
"@sentry-internal/eslint-config-sdk": "7.28.1",
57-
"@sentry-internal/eslint-plugin-sdk": "7.28.1",
56+
"@sentry-internal/eslint-config-sdk": "7.29.0",
57+
"@sentry-internal/eslint-plugin-sdk": "7.29.0",
5858
"@sentry/typescript": "^5.20.1",
5959
"@sentry/wizard": "2.2.0",
6060
"@types/jest": "^26.0.15",

sample/metro.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ const parentDir = path.resolve(__dirname, '..');
1111

1212
module.exports = {
1313
projectRoot: __dirname,
14-
watchFolders: [path.resolve(__dirname, 'node_modules'), parentDir],
14+
watchFolders: [
15+
path.resolve(__dirname, 'node_modules'),
16+
`${parentDir}/dist`,
17+
`${parentDir}/node_modules`,
18+
],
1519
resolver: {
1620
blacklistRE: blacklist([
1721
new RegExp(`${parentDir}/node_modules/react-native/.*`),

test/client.test.ts

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { rejectedSyncPromise, SentryError } from '@sentry/utils';
44
import * as RN from 'react-native';
55

66
import { ReactNativeClient } from '../src/js/client';
7-
import { ReactNativeClientOptions, ReactNativeOptions } from '../src/js/options';
7+
import { ReactNativeClientOptions } from '../src/js/options';
88
import { NativeTransport } from '../src/js/transports/native';
99
import { SDK_NAME, SDK_PACKAGE_NAME, SDK_VERSION } from '../src/js/version';
1010
import { NATIVE } from '../src/js/wrapper';
@@ -67,14 +67,20 @@ jest.mock(
6767
{ virtual: true }
6868
);
6969

70-
const DEFAULT_OPTIONS: ReactNativeOptions = {
70+
const DEFAULT_OPTIONS: ReactNativeClientOptions = {
7171
enableNative: true,
7272
enableNativeCrashHandling: true,
7373
enableNativeNagger: true,
7474
autoInitializeNativeSdk: true,
7575
enableAutoPerformanceTracking: true,
7676
enableOutOfMemoryTracking: true,
77-
patchGlobalPromise: true
77+
patchGlobalPromise: true,
78+
integrations: [],
79+
transport: () => ({
80+
send: jest.fn(),
81+
flush: jest.fn(),
82+
}),
83+
stackParser: jest.fn().mockReturnValue([]),
7884
};
7985

8086
afterEach(() => {
@@ -89,7 +95,7 @@ describe('Tests ReactNativeClient', () => {
8995
...DEFAULT_OPTIONS,
9096
dsn: EXAMPLE_DSN,
9197
transport: () => new NativeTransport()
92-
} as ReactNativeClientOptions);
98+
});
9399

94100
await expect(client.eventFromMessage('test')).resolves.toBeDefined();
95101
// @ts-ignore: Is Mocked
@@ -103,7 +109,7 @@ describe('Tests ReactNativeClient', () => {
103109
...DEFAULT_OPTIONS,
104110
dsn: 'not a dsn',
105111
transport: () => new NativeTransport()
106-
} as ReactNativeClientOptions);
112+
});
107113
} catch (e: any) {
108114
expect(e.message).toBe('Invalid Sentry Dsn: not a dsn');
109115
}
@@ -115,7 +121,7 @@ describe('Tests ReactNativeClient', () => {
115121
...DEFAULT_OPTIONS,
116122
dsn: undefined,
117123
transport: () => new NativeTransport()
118-
} as ReactNativeClientOptions);
124+
});
119125

120126
return expect(backend.eventFromMessage('test')).resolves.toBeDefined();
121127
}).not.toThrow();
@@ -132,7 +138,7 @@ describe('Tests ReactNativeClient', () => {
132138
...DEFAULT_OPTIONS,
133139
dsn: EXAMPLE_DSN,
134140
transport: myCustomTransportFn
135-
} as ReactNativeClientOptions);
141+
});
136142
// eslint-disable-next-line @typescript-eslint/unbound-method
137143
expect(client.getTransport()?.flush).toBe(myFlush);
138144
// eslint-disable-next-line @typescript-eslint/unbound-method
@@ -142,7 +148,7 @@ describe('Tests ReactNativeClient', () => {
142148

143149
describe('onReady', () => {
144150
test('calls onReady callback with true if Native SDK is initialized', (done) => {
145-
new ReactNativeClient({
151+
new ReactNativeClient(mockedOptions({
146152
dsn: EXAMPLE_DSN,
147153
enableNative: true,
148154
onReady: ({ didCallNativeInit }) => {
@@ -151,11 +157,11 @@ describe('Tests ReactNativeClient', () => {
151157
done();
152158
},
153159
transport: () => new NativeTransport()
154-
} as ReactNativeOptions as ReactNativeClientOptions);
160+
}));
155161
});
156162

157163
test('calls onReady callback with false if Native SDK was not initialized', (done) => {
158-
new ReactNativeClient({
164+
new ReactNativeClient(mockedOptions({
159165
dsn: EXAMPLE_DSN,
160166
enableNative: false,
161167
onReady: ({ didCallNativeInit }) => {
@@ -164,7 +170,7 @@ describe('Tests ReactNativeClient', () => {
164170
done();
165171
},
166172
transport: () => new NativeTransport()
167-
} as ReactNativeOptions as ReactNativeClientOptions);
173+
}));
168174
});
169175

170176
test('calls onReady callback with false if Native SDK failed to initialize', (done) => {
@@ -174,7 +180,7 @@ describe('Tests ReactNativeClient', () => {
174180
throw new Error();
175181
});
176182

177-
new ReactNativeClient({
183+
new ReactNativeClient(mockedOptions({
178184
dsn: EXAMPLE_DSN,
179185
enableNative: true,
180186
onReady: ({ didCallNativeInit }) => {
@@ -183,7 +189,7 @@ describe('Tests ReactNativeClient', () => {
183189
done();
184190
},
185191
transport: () => new NativeTransport()
186-
} as ReactNativeOptions as ReactNativeClientOptions);
192+
}));
187193
});
188194
});
189195

@@ -196,7 +202,7 @@ describe('Tests ReactNativeClient', () => {
196202
enableNative: true,
197203
transport: () => new NativeTransport()
198204

199-
} as ReactNativeClientOptions);
205+
});
200206
client.nativeCrash();
201207

202208
expect(RN.NativeModules.RNSentry.crash).toBeCalled();
@@ -213,7 +219,7 @@ describe('Tests ReactNativeClient', () => {
213219
send: mockTransportSend,
214220
flush: jest.fn(),
215221
}),
216-
} as ReactNativeClientOptions);
222+
});
217223

218224
client.captureUserFeedback({
219225
comments: 'Test Comments',
@@ -281,7 +287,7 @@ describe('Tests ReactNativeClient', () => {
281287
send: mockTransportSend,
282288
flush: jest.fn(),
283289
}),
284-
} as ReactNativeClientOptions);
290+
});
285291
});
286292

287293
afterEach(() => {
@@ -325,7 +331,7 @@ describe('Tests ReactNativeClient', () => {
325331
send: mockedSend,
326332
flush: jest.fn().mockResolvedValue(true),
327333
});
328-
const client = new ReactNativeClient(<ReactNativeClientOptions>{
334+
const client = new ReactNativeClient({
329335
...DEFAULT_OPTIONS,
330336
dsn: EXAMPLE_DSN,
331337
transport: mockedTransport,
@@ -351,7 +357,7 @@ describe('Tests ReactNativeClient', () => {
351357
send: mockedSend,
352358
flush: jest.fn().mockResolvedValue(true),
353359
});
354-
const client = new ReactNativeClient(<ReactNativeClientOptions> {
360+
const client = new ReactNativeClient({
355361
...DEFAULT_OPTIONS,
356362
dsn: EXAMPLE_DSN,
357363
transport: mockedTransport,
@@ -386,7 +392,7 @@ describe('Tests ReactNativeClient', () => {
386392
flush: jest.fn(),
387393
}),
388394
sendClientReports: false,
389-
} as ReactNativeClientOptions);
395+
});
390396

391397
mockDroppedEvent(client);
392398

@@ -405,7 +411,7 @@ describe('Tests ReactNativeClient', () => {
405411
flush: jest.fn(),
406412
}),
407413
sendClientReports: true,
408-
} as ReactNativeClientOptions);
414+
});
409415

410416
mockDroppedEvent(client);
411417

@@ -439,7 +445,7 @@ describe('Tests ReactNativeClient', () => {
439445
flush: jest.fn(),
440446
}),
441447
sendClientReports: true,
442-
} as ReactNativeClientOptions);
448+
});
443449

444450
client.captureMessage('message_test_value');
445451

@@ -457,7 +463,7 @@ describe('Tests ReactNativeClient', () => {
457463
flush: jest.fn(),
458464
}),
459465
sendClientReports: true,
460-
} as ReactNativeClientOptions);
466+
});
461467

462468
mockDroppedEvent(client);
463469

@@ -478,7 +484,7 @@ describe('Tests ReactNativeClient', () => {
478484
flush: jest.fn(),
479485
}),
480486
sendClientReports: true,
481-
} as ReactNativeClientOptions);
487+
});
482488

483489
mockDroppedEvent(client);
484490
client.captureMessage('message_test_value_1');
@@ -519,3 +525,15 @@ describe('Tests ReactNativeClient', () => {
519525
}
520526
});
521527
});
528+
529+
function mockedOptions(options: Partial<ReactNativeClientOptions>): ReactNativeClientOptions {
530+
return {
531+
integrations: [],
532+
stackParser: jest.fn().mockReturnValue([]),
533+
transport: () => ({
534+
send: jest.fn(),
535+
flush: jest.fn(),
536+
}),
537+
...options,
538+
};
539+
}

0 commit comments

Comments
 (0)