11import  {  TextDecoder ,  TextEncoder  }  from  'util' ; 
2- // @ts -expect-error patch the encoder on the window, else importing JSDOM fails (deleted in afterAll) 
32const  patchedEncoder  =  ( ! global . window . TextEncoder  &&  ( global . window . TextEncoder  =  TextEncoder ) )  ||  true ; 
43// @ts -expect-error patch the encoder on the window, else importing JSDOM fails (deleted in afterAll) 
54const  patchedDecoder  =  ( ! global . window . TextDecoder  &&  ( global . window . TextDecoder  =  TextDecoder ) )  ||  true ; 
@@ -19,31 +18,23 @@ const makeJSProfile = (partial: Partial<JSSelfProfile> = {}): JSSelfProfile => {
1918  } ; 
2019} ; 
2120
22- // @ts -expect-error store a reference so we can reset it later 
2321const  globalDocument  =  global . document ; 
24- // @ts -expect-error store a reference so we can reset it later 
2522const  globalWindow  =  global . window ; 
26- // @ts -expect-error store a reference so we can reset it later 
2723const  globalLocation  =  global . location ; 
2824
2925describe ( 'convertJSSelfProfileToSampledFormat' ,  ( )  =>  { 
3026  beforeEach ( ( )  =>  { 
3127    const  dom  =  new  JSDOM ( ) ; 
32-     // @ts -expect-error need to override global document 
3328    global . document  =  dom . window . document ; 
3429    // @ts -expect-error need to override global document 
3530    global . window  =  dom . window ; 
36-     // @ts -expect-error need to override global document 
3731    global . location  =  dom . window . location ; 
3832  } ) ; 
3933
4034  // Reset back to previous values 
4135  afterEach ( ( )  =>  { 
42-     // @ts -expect-error need to override global document 
4336    global . document  =  globalDocument ; 
44-     // @ts -expect-error need to override global document 
4537    global . window  =  globalWindow ; 
46-     // @ts -expect-error need to override global document 
4738    global . location  =  globalLocation ; 
4839  } ) ; 
4940
0 commit comments