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 1
1
import { 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' ;
3
3
4
4
import { DEFAULT_HOOKS } from './constants' ;
5
5
import { attachErrorHandler } from './errorhandler' ;
@@ -43,12 +43,12 @@ export function init(
43
43
browserInit ( options ) ;
44
44
45
45
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
+ ) ;
52
52
return ;
53
53
}
54
54
Original file line number Diff line number Diff line change @@ -71,4 +71,23 @@ describe('Sentry.init', () => {
71
71
'[@sentry/vue]: Misconfigured SDK. Vue app is already mounted. Make sure to call `app.mount()` after `Sentry.init()`.' ,
72
72
] ) ;
73
73
} ) ;
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
+ } ) ;
74
93
} ) ;
You can’t perform that action at this time.
0 commit comments