Skip to content

Commit f14e791

Browse files
authored
Merge branch 'main' into alwx/ci/macos-tahoe-cl-runners
2 parents aeb5ed6 + 77271cd commit f14e791

File tree

10 files changed

+180
-88
lines changed

10 files changed

+180
-88
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
});
2727
```
2828

29+
### Dependencies
30+
31+
- Bump JavaScript SDK from v10.38.0 to v10.39.0 ([#5674](https://github.com/getsentry/sentry-react-native/pull/5674))
32+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#10390)
33+
- [diff](https://github.com/getsentry/sentry-javascript/compare/10.38.0...10.39.0)
34+
2935
## 8.0.0
3036

3137
### Upgrading from 7.x to 8.0

dev-packages/e2e-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"devDependencies": {
1414
"@babel/preset-env": "^7.25.3",
1515
"@babel/preset-typescript": "^7.18.6",
16-
"@sentry/core": "10.38.0",
16+
"@sentry/core": "10.39.0",
1717
"@sentry/react-native": "8.0.0",
1818
"@types/node": "^20.9.3",
1919
"@types/react": "^18.2.64",

packages/core/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,20 @@
6969
},
7070
"dependencies": {
7171
"@sentry/babel-plugin-component-annotate": "4.9.1",
72-
"@sentry/browser": "10.38.0",
72+
"@sentry/browser": "10.39.0",
7373
"@sentry/cli": "3.2.0",
74-
"@sentry/core": "10.38.0",
75-
"@sentry/react": "10.38.0",
76-
"@sentry/types": "10.38.0"
74+
"@sentry/core": "10.39.0",
75+
"@sentry/react": "10.39.0",
76+
"@sentry/types": "10.39.0"
7777
},
7878
"devDependencies": {
7979
"@babel/core": "^7.26.7",
8080
"@expo/metro-config": "~0.20.0",
8181
"@mswjs/interceptors": "^0.25.15",
8282
"@react-native/babel-preset": "0.80.0",
83-
"@sentry-internal/eslint-config-sdk": "10.38.0",
84-
"@sentry-internal/eslint-plugin-sdk": "10.38.0",
85-
"@sentry-internal/typescript": "10.38.0",
83+
"@sentry-internal/eslint-config-sdk": "10.39.0",
84+
"@sentry-internal/eslint-plugin-sdk": "10.39.0",
85+
"@sentry-internal/typescript": "10.39.0",
8686
"@sentry/wizard": "6.11.0",
8787
"@testing-library/react-native": "^13.2.2",
8888
"@types/jest": "^29.5.13",

packages/core/src/js/integrations/default.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export function getDefaultIntegrations(options: ReactNativeClientOptions): Integ
132132

133133
integrations.push(expoContextIntegration());
134134

135-
if (options.spotlight) {
135+
if (options.spotlight && __DEV__) {
136136
const sidecarUrl = typeof options.spotlight === 'string' ? options.spotlight : undefined;
137137
integrations.push(spotlightIntegration({ sidecarUrl }));
138138
}

packages/core/src/js/options.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,10 @@ export interface BaseReactNativeOptions {
184184
*
185185
* More details: https://spotlightjs.com/
186186
*
187-
* IMPORTANT: Only set this option to `true` while developing, not in production!
187+
* NOTE: Spotlight is automatically disabled in production builds (when __DEV__ is false).
188+
* If you need Spotlight in non-development environments, you must manually add
189+
* spotlightIntegration() to your integrations array. However, this is not recommended
190+
* as Spotlight requires a local Sidecar server and is designed for development only.
188191
*/
189192
spotlight?: boolean | string;
190193

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import type { Integration } from '@sentry/core';
2+
import { getDefaultIntegrations } from '../../src/js/integrations/default';
3+
import { spotlightIntegration } from '../../src/js/integrations/spotlight';
4+
import type { ReactNativeClientOptions } from '../../src/js/options';
5+
import { notWeb } from '../../src/js/utils/environment';
6+
7+
jest.mock('../../src/js/utils/environment', () => {
8+
const actual = jest.requireActual('../../src/js/utils/environment');
9+
return {
10+
...actual,
11+
notWeb: jest.fn(() => true),
12+
};
13+
});
14+
15+
const spotlightIntegrationName = spotlightIntegration().name;
16+
17+
describe('getDefaultIntegrations - spotlight integration', () => {
18+
let originalDev: boolean | undefined;
19+
20+
beforeEach(() => {
21+
(notWeb as jest.Mock).mockReturnValue(true);
22+
originalDev = (global as typeof globalThis & { __DEV__?: boolean }).__DEV__;
23+
});
24+
25+
afterEach(() => {
26+
(global as typeof globalThis & { __DEV__?: boolean }).__DEV__ = originalDev;
27+
});
28+
29+
const createOptions = (overrides: Partial<ReactNativeClientOptions>): ReactNativeClientOptions => {
30+
return {
31+
dsn: 'https://example.com/1',
32+
enableNative: true,
33+
...overrides,
34+
} as ReactNativeClientOptions;
35+
};
36+
37+
const getIntegrationNames = (options: ReactNativeClientOptions): string[] => {
38+
const integrations = getDefaultIntegrations(options);
39+
return integrations.map((integration: Integration) => integration.name);
40+
};
41+
42+
it('does not add spotlight integration when spotlight option is not set', () => {
43+
(global as typeof globalThis & { __DEV__?: boolean }).__DEV__ = true;
44+
const names = getIntegrationNames(createOptions({}));
45+
46+
expect(names).not.toContain(spotlightIntegrationName);
47+
});
48+
49+
it('adds spotlight integration when spotlight is true and __DEV__ is true', () => {
50+
(global as typeof globalThis & { __DEV__?: boolean }).__DEV__ = true;
51+
const names = getIntegrationNames(createOptions({ spotlight: true }));
52+
53+
expect(names).toContain(spotlightIntegrationName);
54+
});
55+
56+
it('adds spotlight integration when spotlight is a URL string and __DEV__ is true', () => {
57+
(global as typeof globalThis & { __DEV__?: boolean }).__DEV__ = true;
58+
const names = getIntegrationNames(createOptions({ spotlight: 'http://custom-url:8969/stream' }));
59+
60+
expect(names).toContain(spotlightIntegrationName);
61+
});
62+
63+
it('does not add spotlight integration when spotlight is true but __DEV__ is false', () => {
64+
(global as typeof globalThis & { __DEV__?: boolean }).__DEV__ = false;
65+
const names = getIntegrationNames(createOptions({ spotlight: true }));
66+
67+
expect(names).not.toContain(spotlightIntegrationName);
68+
});
69+
70+
it('does not add spotlight integration when spotlight is a URL but __DEV__ is false', () => {
71+
(global as typeof globalThis & { __DEV__?: boolean }).__DEV__ = false;
72+
const names = getIntegrationNames(createOptions({ spotlight: 'http://custom-url:8969/stream' }));
73+
74+
expect(names).not.toContain(spotlightIntegrationName);
75+
});
76+
77+
it('does not add spotlight integration when spotlight is false regardless of __DEV__', () => {
78+
(global as typeof globalThis & { __DEV__?: boolean }).__DEV__ = true;
79+
const names = getIntegrationNames(createOptions({ spotlight: false }));
80+
81+
expect(names).not.toContain(spotlightIntegrationName);
82+
});
83+
});

samples/expo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"eas-build-development-android": "eas build --profile development --platform android"
2323
},
2424
"dependencies": {
25-
"@sentry/core": "10.38.0",
25+
"@sentry/core": "10.39.0",
2626
"@sentry/react-native": "8.0.0",
2727
"@types/react": "~19.1.10",
2828
"expo": "^54.0.0",

samples/react-native-macos/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"@react-navigation/bottom-tabs": "^6.5.12",
1717
"@react-navigation/native": "^6.1.9",
1818
"@react-navigation/stack": "^6.3.20",
19-
"@sentry/core": "10.38.0",
20-
"@sentry/react": "10.38.0",
19+
"@sentry/core": "10.39.0",
20+
"@sentry/react": "10.39.0",
2121
"@sentry/react-native": "8.0.0",
2222
"delay": "^6.0.0",
2323
"react": "18.2.0",

samples/react-native/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
"@react-navigation/native-stack": "^7.3.24",
4848
"@react-navigation/stack": "^7.4.5",
4949
"@reduxjs/toolkit": "^2.8.2",
50-
"@sentry/core": "10.38.0",
51-
"@sentry/react": "10.38.0",
50+
"@sentry/core": "10.39.0",
51+
"@sentry/react": "10.39.0",
5252
"@sentry/react-native": "8.0.0",
5353
"@shopify/flash-list": "^2.0.2",
5454
"delay": "^6.0.0",

0 commit comments

Comments
 (0)