11/* eslint-disable deprecation/deprecation */
22
3- import { getGlobalObject } from '@sentry/utils' ;
3+ import { GLOBAL_OBJ } from '@sentry/utils' ;
44
55import { getCurrentHub , getHubFromCarrier , Hub } from '../src' ;
66
7- const global = getGlobalObject ( ) ;
8-
97describe ( 'global' , ( ) => {
108 test ( 'getGlobalHub' , ( ) => {
119 expect ( getCurrentHub ( ) ) . toBeTruthy ( ) ;
12- expect ( ( global as any ) . __SENTRY__ . hub ) . toBeTruthy ( ) ;
10+ expect ( GLOBAL_OBJ . __SENTRY__ . hub ) . toBeTruthy ( ) ;
1311 } ) ;
1412
1513 test ( 'getHubFromCarrier' , ( ) => {
@@ -22,22 +20,21 @@ describe('global', () => {
2220
2321 test ( 'getGlobalHub' , ( ) => {
2422 const newestHub = new Hub ( undefined , undefined , 999999 ) ;
25- ( global as any ) . __SENTRY__ . hub = newestHub ;
23+ GLOBAL_OBJ . __SENTRY__ . hub = newestHub ;
2624 expect ( getCurrentHub ( ) ) . toBe ( newestHub ) ;
2725 } ) ;
2826
2927 test ( 'hub extension methods receive correct hub instance' , ( ) => {
3028 const newestHub = new Hub ( undefined , undefined , 999999 ) ;
31- ( global as any ) . __SENTRY__ . hub = newestHub ;
29+ GLOBAL_OBJ . __SENTRY__ . hub = newestHub ;
3230 const fn = jest . fn ( ) . mockImplementation ( function ( ...args : [ ] ) {
3331 // @ts -ignore typescript complains that this can be `any`
3432 expect ( this ) . toBe ( newestHub ) ;
3533 expect ( args ) . toEqual ( [ 1 , 2 , 3 ] ) ;
3634 } ) ;
37- ( global as any ) . __SENTRY__ . extensions = { } ;
38- ( global as any ) . __SENTRY__ . extensions . testy = fn ;
35+ GLOBAL_OBJ . __SENTRY__ . extensions = { } ;
36+ GLOBAL_OBJ . __SENTRY__ . extensions . testy = fn ;
3937 ( getCurrentHub ( ) as any ) . _callExtensionMethod ( 'testy' , 1 , 2 , 3 ) ;
4038 expect ( fn ) . toBeCalled ( ) ;
4139 } ) ;
42- // (global as any).__SENTRY__
4340} ) ;
0 commit comments