File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { macroCondition, isDevelopingApp } from '@embroider/macros';
55import { next } from '@ember/runloop' ;
66import { assert , warn } from '@ember/debug' ;
77import Ember from 'ember' ;
8- import { timestampWithMs } from '@sentry/utils' ;
8+ import { setSDKInfo , timestampWithMs } from '@sentry/utils' ;
99
1010declare module '@ember/debug' {
1111 export function assert ( desc : string , test : unknown ) : void ;
@@ -19,6 +19,7 @@ export function InitSentryForEmber(_runtimeConfig: BrowserOptions | undefined) {
1919 const initConfig = Object . assign ( { } , config . sentry , _runtimeConfig || { } ) ;
2020
2121 createEmberEventProcessor ( ) ;
22+ setSDKInfo ( 'sentry.javascript.ember' , 'npm:@sentry/ember' , SDK_VERSION ) ;
2223
2324 Sentry . init ( initConfig ) ;
2425
Original file line number Diff line number Diff line change 1+ import { module , test } from 'qunit' ;
2+ import * as Sentry from '@sentry/ember' ;
3+ import { getGlobalObject } from '@sentry/utils' ;
4+
5+ const global = getGlobalObject < Window > ( ) ;
6+
7+ module ( 'Unit | SDK initialization' , function ( ) {
8+ test ( 'adds SDK metadata globally' , function ( assert ) {
9+ // the SDK data is set when we import from @sentry /ember (and therefore run `addon/index.ts`) - it sets the ember
10+ // part itself, and the browser part gets set when it imports from @sentry/browser - so no action is necessary here
11+ // before we run the `assert`s
12+
13+ assert . equal ( global . __SENTRY__ ?. sdkInfo ?. name , 'sentry.javascript.ember' ) ;
14+ assert . equal ( global . __SENTRY__ ?. sdkInfo ?. version , Sentry . SDK_VERSION ) ;
15+ assert . deepEqual ( global . __SENTRY__ ?. sdkInfo ?. packages , [
16+ { name : 'npm:@sentry/browser' , version : Sentry . SDK_VERSION } ,
17+ { name : 'npm:@sentry/ember' , version : Sentry . SDK_VERSION } ,
18+ ] ) ;
19+ } ) ;
20+ } ) ;
You can’t perform that action at this time.
0 commit comments