Skip to content

Commit 6196871

Browse files
committed
feat(vercel-edge): return client from init
1 parent 1b65f1a commit 6196871

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

packages/vercel-edge/src/sdk.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
linkedErrorsIntegration,
77
requestDataIntegration,
88
} from '@sentry/core';
9-
import type { Integration, Options } from '@sentry/types';
9+
import type { Client, Integration, Options } from '@sentry/types';
1010
import { GLOBAL_OBJ, createStackParser, nodeStackLineParser, stackParserFromStackParserOptions } from '@sentry/utils';
1111

1212
import { setAsyncLocalStorageAsyncContextStrategy } from './async';
@@ -34,7 +34,7 @@ export function getDefaultIntegrations(options: Options): Integration[] {
3434
}
3535

3636
/** Inits the Sentry NextJS SDK on the Edge Runtime. */
37-
export function init(options: VercelEdgeOptions = {}): void {
37+
export function init(options: VercelEdgeOptions = {}): Client | undefined {
3838
setAsyncLocalStorageAsyncContextStrategy();
3939

4040
if (options.defaultIntegrations === undefined) {
@@ -76,7 +76,7 @@ export function init(options: VercelEdgeOptions = {}): void {
7676
transport: options.transport || makeEdgeTransport,
7777
};
7878

79-
initAndBind(VercelEdgeClient, clientOptions);
79+
return initAndBind(VercelEdgeClient, clientOptions);
8080
}
8181

8282
/**

packages/vercel-edge/test/sdk.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import * as SentryCore from '@sentry/core';
2+
import { init } from '../src/sdk';
3+
4+
describe('init', () => {
5+
it('initializes and returns client', () => {
6+
const initSpy = jest.spyOn(SentryCore, 'initAndBind');
7+
8+
expect(init({})).not.toBeUndefined();
9+
expect(initSpy).toHaveBeenCalledTimes(1);
10+
});
11+
});

0 commit comments

Comments
 (0)