1
1
import { TextDecoder , TextEncoder } from 'util' ;
2
- // @ts -expect-error patch the encoder on the window, else importing JSDOM fails (deleted in afterAll)
3
2
const patchedEncoder = ( ! global . window . TextEncoder && ( global . window . TextEncoder = TextEncoder ) ) || true ;
4
3
// @ts -expect-error patch the encoder on the window, else importing JSDOM fails (deleted in afterAll)
5
4
const patchedDecoder = ( ! global . window . TextDecoder && ( global . window . TextDecoder = TextDecoder ) ) || true ;
@@ -19,31 +18,23 @@ const makeJSProfile = (partial: Partial<JSSelfProfile> = {}): JSSelfProfile => {
19
18
} ;
20
19
} ;
21
20
22
- // @ts -expect-error store a reference so we can reset it later
23
21
const globalDocument = global . document ;
24
- // @ts -expect-error store a reference so we can reset it later
25
22
const globalWindow = global . window ;
26
- // @ts -expect-error store a reference so we can reset it later
27
23
const globalLocation = global . location ;
28
24
29
25
describe ( 'convertJSSelfProfileToSampledFormat' , ( ) => {
30
26
beforeEach ( ( ) => {
31
27
const dom = new JSDOM ( ) ;
32
- // @ts -expect-error need to override global document
33
28
global . document = dom . window . document ;
34
29
// @ts -expect-error need to override global document
35
30
global . window = dom . window ;
36
- // @ts -expect-error need to override global document
37
31
global . location = dom . window . location ;
38
32
} ) ;
39
33
40
34
// Reset back to previous values
41
35
afterEach ( ( ) => {
42
- // @ts -expect-error need to override global document
43
36
global . document = globalDocument ;
44
- // @ts -expect-error need to override global document
45
37
global . window = globalWindow ;
46
- // @ts -expect-error need to override global document
47
38
global . location = globalLocation ;
48
39
} ) ;
49
40
0 commit comments