File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 6161 "fix" : " run-s fix:eslint fix:prettier" ,
6262 "fix:prettier" : " prettier --write \" {src,test}/**/*.ts\" " ,
6363 "fix:eslint" : " eslint . --format stylish --fix" ,
64- "test" : " jest --passWithNoTests " ,
64+ "test" : " jest" ,
6565 "test:watch" : " jest --watch" ,
6666 "pack" : " npm pack"
6767 },
Original file line number Diff line number Diff line change @@ -17,7 +17,13 @@ export {
1717 setUser ,
1818 startTransaction ,
1919 withScope ,
20+ SDK_VERSION ,
2021} from '@sentry/browser' ;
2122
2223export { init } from './sdk' ;
2324export { vueRouterInstrumentation } from './vuerouter' ;
25+
26+ import { SDK_VERSION } from '@sentry/browser' ;
27+ import { setSDKInfo } from '@sentry/utils' ;
28+
29+ setSDKInfo ( 'sentry.javascript.vue' , 'npm:@sentry/vue' , SDK_VERSION ) ;
Original file line number Diff line number Diff line change 1+ import { getGlobalObject } from '@sentry/utils' ;
2+
3+ import * as Sentry from '../src/index' ;
4+
5+ const global = getGlobalObject < Window > ( ) ;
6+
7+ describe ( 'event SDK info' , ( ) => {
8+ it ( 'adds SDK metadata globally' , ( ) => {
9+ // the SDK data is set when we import from (and therefore run) `../src/index.ts` - it sets the vue part itself,
10+ // and the browser part gets set when it imports from @sentry /browser - so no action is necessary here before we run
11+ // the `expect`s
12+
13+ expect ( global . __SENTRY__ ?. sdkInfo ) . toBeDefined ( ) ;
14+ expect ( global . __SENTRY__ ?. sdkInfo ?. name ) . toEqual ( 'sentry.javascript.vue' ) ;
15+ expect ( global . __SENTRY__ ?. sdkInfo ?. version ) . toEqual ( Sentry . SDK_VERSION ) ;
16+ expect ( global . __SENTRY__ ?. sdkInfo ?. packages ) . toEqual (
17+ expect . arrayContaining ( [
18+ { name : 'npm:@sentry/vue' , version : Sentry . SDK_VERSION } ,
19+ { name : 'npm:@sentry/browser' , version : Sentry . SDK_VERSION } ,
20+ ] ) ,
21+ ) ;
22+ } ) ;
23+ } ) ;
You can’t perform that action at this time.
0 commit comments