@@ -2,10 +2,13 @@ import type { Event as SentryEvent, ExtendedError } from '@sentry/types';
2
2
3
3
import { extraErrorDataIntegration } from '../../../src/integrations/extraerrordata' ;
4
4
5
+ import { TestClient , getDefaultTestClientOptions } from '../../mocks/client' ;
6
+
5
7
const extraErrorData = extraErrorDataIntegration ( ) ;
6
8
let event : SentryEvent ;
7
9
8
10
describe ( 'ExtraErrorData()' , ( ) => {
11
+ const testClient = new TestClient ( getDefaultTestClientOptions ( { maxValueLength : 250 } ) ) ;
9
12
beforeEach ( ( ) => {
10
13
event = { } ;
11
14
} ) ;
@@ -20,7 +23,7 @@ describe('ExtraErrorData()', () => {
20
23
{
21
24
originalException : error ,
22
25
} ,
23
- { } as any ,
26
+ testClient ,
24
27
) as SentryEvent ;
25
28
26
29
expect ( enhancedEvent . contexts ) . toEqual ( {
@@ -41,13 +44,13 @@ describe('ExtraErrorData()', () => {
41
44
{
42
45
originalException : error ,
43
46
} ,
44
- { } as any ,
47
+ testClient ,
45
48
) as SentryEvent ;
46
49
47
50
expect ( enhancedEvent . contexts ) . toEqual ( {
48
51
TypeError : {
49
52
baz : 42 ,
50
- foo : 'a' . repeat ( 250 ) ,
53
+ foo : ` ${ 'a' . repeat ( 250 ) } ...` ,
51
54
} ,
52
55
} ) ;
53
56
} ) ;
@@ -61,7 +64,7 @@ describe('ExtraErrorData()', () => {
61
64
{
62
65
originalException : error ,
63
66
} ,
64
- { } as any ,
67
+ testClient ,
65
68
) as SentryEvent ;
66
69
67
70
expect ( enhancedEvent . contexts ) . toEqual ( {
@@ -86,7 +89,7 @@ describe('ExtraErrorData()', () => {
86
89
{
87
90
originalException : error ,
88
91
} ,
89
- { } as any ,
92
+ testClient ,
90
93
) as SentryEvent ;
91
94
92
95
expect ( enhancedEvent . contexts ) . toEqual ( {
@@ -114,7 +117,7 @@ describe('ExtraErrorData()', () => {
114
117
{
115
118
originalException : error ,
116
119
} ,
117
- { } as any ,
120
+ testClient ,
118
121
) as SentryEvent ;
119
122
120
123
expect ( enhancedEvent . contexts ) . toEqual ( {
@@ -133,14 +136,14 @@ describe('ExtraErrorData()', () => {
133
136
{
134
137
originalException : error ,
135
138
} ,
136
- { } as any ,
139
+ testClient ,
137
140
) as SentryEvent ;
138
141
139
142
expect ( enhancedEvent ) . toEqual ( event ) ;
140
143
} ) ;
141
144
142
145
it ( 'should return event if there is no SentryEventHint' , ( ) => {
143
- const enhancedEvent = extraErrorData . processEvent ?.( event , { } , { } as any ) ;
146
+ const enhancedEvent = extraErrorData . processEvent ?.( event , { } , testClient ) ;
144
147
145
148
expect ( enhancedEvent ) . toEqual ( event ) ;
146
149
} ) ;
@@ -152,7 +155,7 @@ describe('ExtraErrorData()', () => {
152
155
// @ts -expect-error Allow event to have extra properties
153
156
notOriginalException : 'fooled you' ,
154
157
} ,
155
- { } as any ,
158
+ testClient ,
156
159
) ;
157
160
158
161
expect ( enhancedEvent ) . toEqual ( event ) ;
@@ -174,7 +177,7 @@ describe('ExtraErrorData()', () => {
174
177
{
175
178
originalException : error ,
176
179
} ,
177
- { } as any ,
180
+ testClient ,
178
181
) as SentryEvent ;
179
182
180
183
expect ( enhancedEvent . contexts ) . toEqual ( {
@@ -201,7 +204,7 @@ describe('ExtraErrorData()', () => {
201
204
{
202
205
originalException : error ,
203
206
} ,
204
- { } as any ,
207
+ testClient ,
205
208
) as SentryEvent ;
206
209
207
210
expect ( enhancedEvent . contexts ) . toEqual ( {
@@ -225,7 +228,7 @@ describe('ExtraErrorData()', () => {
225
228
{
226
229
originalException : error ,
227
230
} ,
228
- { } as any ,
231
+ testClient ,
229
232
) as SentryEvent ;
230
233
231
234
expect ( enhancedEvent . contexts ) . toEqual ( {
@@ -253,7 +256,7 @@ describe('ExtraErrorData()', () => {
253
256
{
254
257
originalException : error ,
255
258
} ,
256
- { } as any ,
259
+ testClient ,
257
260
) as SentryEvent ;
258
261
259
262
expect ( enhancedEvent . contexts ) . toEqual ( {
@@ -282,7 +285,7 @@ describe('ExtraErrorData()', () => {
282
285
{
283
286
originalException : error ,
284
287
} ,
285
- { } as any ,
288
+ testClient ,
286
289
) as SentryEvent ;
287
290
288
291
expect ( enhancedEvent . contexts ) . not . toEqual ( {
0 commit comments