1
1
import { Integration } from '@sentry/types' ;
2
+
2
3
import { init } from '../src/sdk' ;
3
4
import * as sdk from '../src/sdk' ;
4
5
@@ -9,7 +10,7 @@ const PUBLIC_DSN = 'https://username@domain/123';
9
10
10
11
class MockIntegration implements Integration {
11
12
public name : string ;
12
- public setupOnce = jest . fn ( ) ;
13
+ public setupOnce : jest . Mock = jest . fn ( ) ;
13
14
public constructor ( name : string ) {
14
15
this . name = name ;
15
16
}
@@ -23,7 +24,7 @@ describe('init()', () => {
23
24
} ) ;
24
25
25
26
afterEach ( ( ) => {
26
- // @ts -ignore
27
+ // @ts -ignore - Reset the default integrations of node sdk to original
27
28
sdk . defaultIntegrations = defaultIntegrationsBackup ;
28
29
} ) ;
29
30
@@ -33,7 +34,7 @@ describe('init()', () => {
33
34
new MockIntegration ( 'Mock integration 1.2' ) ,
34
35
] ;
35
36
36
- //@ts -ignore
37
+ // @ts -ignore - Replace default integrations with mock integrations, needs ts-ignore because imports are readonly
37
38
sdk . defaultIntegrations = mockDefaultIntegrations ;
38
39
39
40
init ( { dsn : PUBLIC_DSN , defaultIntegrations : false } ) ;
@@ -48,7 +49,7 @@ describe('init()', () => {
48
49
new MockIntegration ( 'Some mock integration 2.2' ) ,
49
50
] ;
50
51
51
- //@ts -ignore
52
+ // @ts -ignore - Replace default integrations with mock integrations, needs ts-ignore because imports are readonly
52
53
sdk . defaultIntegrations = mockDefaultIntegrations ;
53
54
54
55
const mockIntegrations = [
@@ -70,7 +71,7 @@ describe('init()', () => {
70
71
new MockIntegration ( 'Some mock integration 3.2' ) ,
71
72
] ;
72
73
73
- //@ts -ignore
74
+ // @ts -ignore - Replace default integrations with mock integrations, needs ts-ignore because imports are readonly
74
75
sdk . defaultIntegrations = mockDefaultIntegrations ;
75
76
76
77
const newIntegration = new MockIntegration ( 'Some mock integration 3.3' ) ;
0 commit comments