Skip to content

Commit 0591b1b

Browse files
authored
feat(bun): Expose spotlight option in TypeScript (#18436)
(closes #18419) (closes [JS-1261](https://linear.app/getsentry/issue/JS-1261/add-support-for-spotlight-in-sentrybun)) It seems that for Bun we are already using the init function of `@sentry/node`, so all the options are passed do satisfy the `NodeOptions`. This is now re-exporting `spotlight` as an option. (related: #17349)
1 parent 847daf0 commit 0591b1b

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

packages/bun/src/types.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ export interface BaseBunOptions {
2222
/** Sets an optional server name (device name) */
2323
serverName?: string;
2424

25+
/**
26+
* If you use Spotlight by Sentry during development, use
27+
* this option to forward captured Sentry events to Spotlight.
28+
*
29+
* Either set it to true, or provide a specific Spotlight Sidecar URL.
30+
*
31+
* More details: https://spotlightjs.com/
32+
*
33+
* IMPORTANT: Only set this option to `true` while developing, not in production!
34+
*/
35+
spotlight?: boolean | string;
36+
2537
/**
2638
* If this is set to true, the SDK will not set up OpenTelemetry automatically.
2739
* In this case, you _have_ to ensure to set it up correctly yourself, including:

packages/bun/test/init.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ describe('init()', () => {
3838
expect(mockAutoPerformanceIntegrations).toHaveBeenCalledTimes(0);
3939
});
4040

41+
it('enables spotlight with default URL from config `true`', () => {
42+
const client = init({ dsn: PUBLIC_DSN, spotlight: true });
43+
44+
expect(client?.getOptions().spotlight).toBe(true);
45+
expect(client?.getOptions().integrations.some(integration => integration.name === 'Spotlight')).toBe(true);
46+
});
47+
48+
it('disables spotlight from config `false`', () => {
49+
const client = init({ dsn: PUBLIC_DSN, spotlight: false });
50+
51+
expect(client?.getOptions().spotlight).toBe(false);
52+
expect(client?.getOptions().integrations.some(integration => integration.name === 'Spotlight')).toBe(false);
53+
});
54+
4155
it('installs merged default integrations, with overrides provided through options', () => {
4256
const mockDefaultIntegrations = [
4357
new MockIntegration('Some mock integration 2.1'),

0 commit comments

Comments
 (0)