From 167b6dbc785dfac32201c01ec2f0c40e261e1c32 Mon Sep 17 00:00:00 2001 From: JPeer264 Date: Tue, 9 Dec 2025 10:43:52 +0100 Subject: [PATCH] feat(bun): Expose spotlight option in TypeScript --- packages/bun/src/types.ts | 12 ++++++++++++ packages/bun/test/init.test.ts | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/packages/bun/src/types.ts b/packages/bun/src/types.ts index afec75d1ee8d..91686f9cf8c3 100644 --- a/packages/bun/src/types.ts +++ b/packages/bun/src/types.ts @@ -22,6 +22,18 @@ export interface BaseBunOptions { /** Sets an optional server name (device name) */ serverName?: string; + /** + * If you use Spotlight by Sentry during development, use + * this option to forward captured Sentry events to Spotlight. + * + * Either set it to true, or provide a specific Spotlight Sidecar URL. + * + * More details: https://spotlightjs.com/ + * + * IMPORTANT: Only set this option to `true` while developing, not in production! + */ + spotlight?: boolean | string; + /** * If this is set to true, the SDK will not set up OpenTelemetry automatically. * In this case, you _have_ to ensure to set it up correctly yourself, including: diff --git a/packages/bun/test/init.test.ts b/packages/bun/test/init.test.ts index 4b2ddd452713..0dd76a3a4072 100644 --- a/packages/bun/test/init.test.ts +++ b/packages/bun/test/init.test.ts @@ -38,6 +38,20 @@ describe('init()', () => { expect(mockAutoPerformanceIntegrations).toHaveBeenCalledTimes(0); }); + it('enables spotlight with default URL from config `true`', () => { + const client = init({ dsn: PUBLIC_DSN, spotlight: true }); + + expect(client?.getOptions().spotlight).toBe(true); + expect(client?.getOptions().integrations.some(integration => integration.name === 'Spotlight')).toBe(true); + }); + + it('disables spotlight from config `false`', () => { + const client = init({ dsn: PUBLIC_DSN, spotlight: false }); + + expect(client?.getOptions().spotlight).toBe(false); + expect(client?.getOptions().integrations.some(integration => integration.name === 'Spotlight')).toBe(false); + }); + it('installs merged default integrations, with overrides provided through options', () => { const mockDefaultIntegrations = [ new MockIntegration('Some mock integration 2.1'),