File tree Expand file tree Collapse file tree 2 files changed +26
-7
lines changed Expand file tree Collapse file tree 2 files changed +26
-7
lines changed Original file line number Diff line number Diff line change 11import { init as browserInit , SDK_VERSION } from '@sentry/browser' ;
2- import { arrayify , GLOBAL_OBJ , logger } from '@sentry/utils' ;
2+ import { arrayify , GLOBAL_OBJ } from '@sentry/utils' ;
33
44import { DEFAULT_HOOKS } from './constants' ;
55import { attachErrorHandler } from './errorhandler' ;
@@ -43,12 +43,12 @@ export function init(
4343 browserInit ( options ) ;
4444
4545 if ( ! options . Vue && ! options . app ) {
46- __DEBUG_BUILD__ &&
47- logger . warn (
48- ' Misconfigured SDK. Vue specific errors will not be captured.\n' +
49- ' Update your `Sentry.init` call with an appropriate config option:\n' +
50- ' `app` (Application Instance - Vue 3) or `Vue` (Vue Constructor - Vue 2).' ,
51- ) ;
46+ // eslint-disable-next-line no-console
47+ console . warn (
48+ `[@sentry/vue]: Misconfigured SDK. Vue specific errors will not be captured.
49+ Update your \ `Sentry.init\ ` call with an appropriate config option:
50+ \ `app\ ` (Application Instance - Vue 3) or \ `Vue\ ` (Vue Constructor - Vue 2).` ,
51+ ) ;
5252 return ;
5353 }
5454
Original file line number Diff line number Diff line change @@ -71,4 +71,23 @@ describe('Sentry.init', () => {
7171 '[@sentry/vue]: Misconfigured SDK. Vue app is already mounted. Make sure to call `app.mount()` after `Sentry.init()`.' ,
7272 ] ) ;
7373 } ) ;
74+
75+ it ( 'warns when not passing app & Vue' , ( ) => {
76+ const el = document . createElement ( 'div' ) ;
77+ const app = createApp ( {
78+ template : '<div>hello</div>' ,
79+ } ) ;
80+
81+ Sentry . init ( {
82+ defaultIntegrations : false ,
83+ } ) ;
84+
85+ app . mount ( el ) ;
86+
87+ expect ( warnings ) . toEqual ( [
88+ `[@sentry/vue]: Misconfigured SDK. Vue specific errors will not be captured.
89+ Update your \`Sentry.init\` call with an appropriate config option:
90+ \`app\` (Application Instance - Vue 3) or \`Vue\` (Vue Constructor - Vue 2).` ,
91+ ] ) ;
92+ } ) ;
7493} ) ;
You can’t perform that action at this time.
0 commit comments