File tree Expand file tree Collapse file tree 6 files changed +47
-9
lines changed Expand file tree Collapse file tree 6 files changed +47
-9
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## Unreleased
4+
5+ - Add ` spotlight ` option ([ #4023 ] ( https://github.com/getsentry/sentry-react-native/pull/4023 ) )
6+ - Deprecating ` enableSpotlight ` and ` spotlightSidecarUrl `
7+
38## 5.29.0
49
510### Features
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ process.env.EXPO_SKIP_DURING_EXPORT !== 'true' && Sentry.init({
8484 // replaysOnErrorSampleRate: 1.0,
8585 replaysSessionSampleRate : 1.0 ,
8686 } ,
87- enableSpotlight : true ,
87+ spotlight : true ,
8888} ) ;
8989
9090function RootLayout ( ) {
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ Sentry.init({
123123 // replaysSessionSampleRate: 1.0,
124124 replaysOnErrorSampleRate : 1.0 ,
125125 } ,
126- enableSpotlight : true ,
126+ spotlight : true ,
127127 // This should be disabled when manually initializing the native SDK
128128 // Note that options from JS are not passed to the native SDKs when initialized manually
129129 autoInitializeNativeSdk : true ,
Original file line number Diff line number Diff line change @@ -108,12 +108,9 @@ export function getDefaultIntegrations(options: ReactNativeClientOptions): Integ
108108 integrations . push ( expoContextIntegration ( ) ) ;
109109 }
110110
111- if ( options . enableSpotlight ) {
112- integrations . push (
113- spotlightIntegration ( {
114- sidecarUrl : options . spotlightSidecarUrl ,
115- } ) ,
116- ) ;
111+ if ( options . spotlight || options . enableSpotlight ) {
112+ const sidecarUrl = ( typeof options . spotlight === 'string' && options . spotlight ) || options . spotlightSidecarUrl ;
113+ integrations . push ( spotlightIntegration ( { sidecarUrl } ) ) ;
117114 }
118115
119116 if (
Original file line number Diff line number Diff line change @@ -166,6 +166,8 @@ export interface BaseReactNativeOptions {
166166 * More details: https://spotlightjs.com/
167167 *
168168 * IMPORTANT: Only set this option to `true` while developing, not in production!
169+ *
170+ * @deprecated Use `spotlight` instead.
169171 */
170172 enableSpotlight ?: boolean ;
171173
@@ -178,9 +180,23 @@ export interface BaseReactNativeOptions {
178180 * More details: https://spotlightjs.com/
179181 *
180182 * @default "http://localhost:8969/stream"
183+ *
184+ * @deprecated Use `spotlight` instead.
181185 */
182186 spotlightSidecarUrl ?: string ;
183187
188+ /**
189+ * If you use Spotlight by Sentry during development, use
190+ * this option to forward captured Sentry events to Spotlight.
191+ *
192+ * Either set it to true, or provide a specific Spotlight Sidecar URL.
193+ *
194+ * More details: https://spotlightjs.com/
195+ *
196+ * IMPORTANT: Only set this option to `true` while developing, not in production!
197+ */
198+ spotlight ?: boolean | string ;
199+
184200 /**
185201 * Sets a callback which is executed before capturing screenshots. Only
186202 * relevant if `attachScreenshot` is set to true. When false is returned
Original file line number Diff line number Diff line change @@ -432,7 +432,7 @@ describe('Tests the SDK functionality', () => {
432432 expect ( actualIntegrations ) . toEqual ( expect . not . arrayContaining ( [ expect . objectContaining ( { name : 'Spotlight' } ) ] ) ) ;
433433 } ) ;
434434
435- it ( 'adds spotlight integration' , ( ) => {
435+ it ( 'adds spotlight integration with enableSpotlight ' , ( ) => {
436436 init ( {
437437 enableSpotlight : true ,
438438 } ) ;
@@ -442,6 +442,26 @@ describe('Tests the SDK functionality', () => {
442442 expect ( actualIntegrations ) . toEqual ( expect . arrayContaining ( [ expect . objectContaining ( { name : 'Spotlight' } ) ] ) ) ;
443443 } ) ;
444444
445+ it ( 'adds spotlight integration with spotlight bool' , ( ) => {
446+ init ( {
447+ spotlight : true ,
448+ } ) ;
449+
450+ const actualOptions = usedOptions ( ) ;
451+ const actualIntegrations = actualOptions ?. integrations ;
452+ expect ( actualIntegrations ) . toEqual ( expect . arrayContaining ( [ expect . objectContaining ( { name : 'Spotlight' } ) ] ) ) ;
453+ } ) ;
454+
455+ it ( 'adds spotlight integration with direct url' , ( ) => {
456+ init ( {
457+ spotlight : 'http://localhost:8969/stream' ,
458+ } ) ;
459+
460+ const actualOptions = usedOptions ( ) ;
461+ const actualIntegrations = actualOptions ?. integrations ;
462+ expect ( actualIntegrations ) . toEqual ( expect . arrayContaining ( [ expect . objectContaining ( { name : 'Spotlight' } ) ] ) ) ;
463+ } ) ;
464+
445465 it ( 'no default integrations' , ( ) => {
446466 init ( {
447467 defaultIntegrations : false ,
You can’t perform that action at this time.
0 commit comments