Skip to content

Commit df35cd5

Browse files
committed
feat(vue): return client from init
1 parent 6196871 commit df35cd5

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

packages/vue/src/sdk.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { SDK_VERSION, getDefaultIntegrations, init as browserInit } from '@sentry/browser';
22

3+
import type { Client } from '@sentry/types';
34
import { vueIntegration } from './integration';
45
import type { Options, TracingOptions } from './types';
56

@@ -8,7 +9,7 @@ import type { Options, TracingOptions } from './types';
89
*/
910
export function init(
1011
config: Partial<Omit<Options, 'tracingOptions'> & { tracingOptions: Partial<TracingOptions> }> = {},
11-
): void {
12+
): Client | undefined {
1213
const options = {
1314
_metadata: {
1415
sdk: {
@@ -26,5 +27,5 @@ export function init(
2627
...config,
2728
};
2829

29-
browserInit(options);
30+
return browserInit(options);
3031
}

packages/vue/test/integration/init.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { createApp } from 'vue';
22

3+
import type { Client } from '@sentry/types';
34
import type { Options } from '../../src/types';
45
import * as Sentry from './../../src';
56

@@ -100,12 +101,16 @@ Update your \`Sentry.init\` call with an appropriate config option:
100101

101102
expect(warnings).toEqual([]);
102103
});
104+
105+
it('returns client from init', () => {
106+
expect(runInit({})).not.toBeUndefined();
107+
});
103108
});
104109

105-
function runInit(options: Partial<Options>): void {
110+
function runInit(options: Partial<Options>): Client | undefined {
106111
const integration = Sentry.vueIntegration();
107112

108-
Sentry.init({
113+
return Sentry.init({
109114
dsn: PUBLIC_DSN,
110115
defaultIntegrations: false,
111116
integrations: [integration],

0 commit comments

Comments
 (0)