@@ -10,6 +10,7 @@ import { browserPerformanceTimeOrigin, GLOBAL_OBJ, timestampWithMs } from '@sent
1010import { macroCondition , isTesting , getOwnConfig } from '@embroider/macros' ;
1111import { EmberSentryConfig , GlobalConfig , OwnConfig } from '../types' ;
1212import RouterService from '@ember/routing/router-service' ;
13+ import { BaseClient } from '@sentry/core' ;
1314
1415function getSentryConfig ( ) {
1516 const _global = GLOBAL_OBJ as typeof GLOBAL_OBJ & GlobalConfig ;
@@ -416,20 +417,12 @@ export async function instrumentForPerformance(appInstance: ApplicationInstance)
416417 } ) ;
417418
418419 if ( macroCondition ( isTesting ( ) ) ) {
419- class FakeBrowserTracingClass {
420- static id = 'BrowserTracing' ;
421- public name = FakeBrowserTracingClass . id ;
422- setupOnce ( ) {
423- // noop - We're just faking this class for a lookup
424- }
425- }
420+ const client = Sentry . getCurrentHub ( ) . getClient ( ) ;
426421
427422 if (
428- Sentry . getCurrentHub ( ) ?. getIntegration (
429- // This is a temporary hack because the BrowserTracing integration cannot have a static `id` field for tree
430- // shaking reasons. However, `getIntegration` needs that field.
431- FakeBrowserTracingClass ,
432- )
423+ client &&
424+ ( client as BaseClient < any > ) . getIntegrationById &&
425+ ( client as BaseClient < any > ) . getIntegrationById ( 'BrowserTracing' )
433426 ) {
434427 // Initializers are called more than once in tests, causing the integrations to not be setup correctly.
435428 return ;
0 commit comments