@@ -2,10 +2,13 @@ import type { Event as SentryEvent, ExtendedError } from '@sentry/types';
22
33import  {  extraErrorDataIntegration  }  from  '../../../src/integrations/extraerrordata' ; 
44
5+ import  {  TestClient ,  getDefaultTestClientOptions  }  from  '../../mocks/client' ; 
6+ 
57const  extraErrorData  =  extraErrorDataIntegration ( ) ; 
68let  event : SentryEvent ; 
79
810describe ( 'ExtraErrorData()' ,  ( )  =>  { 
11+   const  testClient  =  new  TestClient ( getDefaultTestClientOptions ( {  maxValueLength : 250  } ) ) ; 
912  beforeEach ( ( )  =>  { 
1013    event  =  { } ; 
1114  } ) ; 
@@ -20,7 +23,7 @@ describe('ExtraErrorData()', () => {
2023      { 
2124        originalException : error , 
2225      } , 
23-       { }   as   any , 
26+       testClient , 
2427    )  as  SentryEvent ; 
2528
2629    expect ( enhancedEvent . contexts ) . toEqual ( { 
@@ -41,13 +44,13 @@ describe('ExtraErrorData()', () => {
4144      { 
4245        originalException : error , 
4346      } , 
44-       { }   as   any , 
47+       testClient , 
4548    )  as  SentryEvent ; 
4649
4750    expect ( enhancedEvent . contexts ) . toEqual ( { 
4851      TypeError : { 
4952        baz : 42 , 
50-         foo : 'a' . repeat ( 250 ) , 
53+         foo : ` ${ 'a' . repeat ( 250 ) } ...` , 
5154      } , 
5255    } ) ; 
5356  } ) ; 
@@ -61,7 +64,7 @@ describe('ExtraErrorData()', () => {
6164      { 
6265        originalException : error , 
6366      } , 
64-       { }   as   any , 
67+       testClient , 
6568    )  as  SentryEvent ; 
6669
6770    expect ( enhancedEvent . contexts ) . toEqual ( { 
@@ -86,7 +89,7 @@ describe('ExtraErrorData()', () => {
8689      { 
8790        originalException : error , 
8891      } , 
89-       { }   as   any , 
92+       testClient , 
9093    )  as  SentryEvent ; 
9194
9295    expect ( enhancedEvent . contexts ) . toEqual ( { 
@@ -114,7 +117,7 @@ describe('ExtraErrorData()', () => {
114117      { 
115118        originalException : error , 
116119      } , 
117-       { }   as   any , 
120+       testClient , 
118121    )  as  SentryEvent ; 
119122
120123    expect ( enhancedEvent . contexts ) . toEqual ( { 
@@ -133,14 +136,14 @@ describe('ExtraErrorData()', () => {
133136      { 
134137        originalException : error , 
135138      } , 
136-       { }   as   any , 
139+       testClient , 
137140    )  as  SentryEvent ; 
138141
139142    expect ( enhancedEvent ) . toEqual ( event ) ; 
140143  } ) ; 
141144
142145  it ( 'should return event if there is no SentryEventHint' ,  ( )  =>  { 
143-     const  enhancedEvent  =  extraErrorData . processEvent ?.( event ,  { } ,  { }   as   any ) ; 
146+     const  enhancedEvent  =  extraErrorData . processEvent ?.( event ,  { } ,  testClient ) ; 
144147
145148    expect ( enhancedEvent ) . toEqual ( event ) ; 
146149  } ) ; 
@@ -152,7 +155,7 @@ describe('ExtraErrorData()', () => {
152155        // @ts -expect-error Allow event to have extra properties 
153156        notOriginalException : 'fooled you' , 
154157      } , 
155-       { }   as   any , 
158+       testClient , 
156159    ) ; 
157160
158161    expect ( enhancedEvent ) . toEqual ( event ) ; 
@@ -174,7 +177,7 @@ describe('ExtraErrorData()', () => {
174177      { 
175178        originalException : error , 
176179      } , 
177-       { }   as   any , 
180+       testClient , 
178181    )  as  SentryEvent ; 
179182
180183    expect ( enhancedEvent . contexts ) . toEqual ( { 
@@ -201,7 +204,7 @@ describe('ExtraErrorData()', () => {
201204      { 
202205        originalException : error , 
203206      } , 
204-       { }   as   any , 
207+       testClient , 
205208    )  as  SentryEvent ; 
206209
207210    expect ( enhancedEvent . contexts ) . toEqual ( { 
@@ -225,7 +228,7 @@ describe('ExtraErrorData()', () => {
225228      { 
226229        originalException : error , 
227230      } , 
228-       { }   as   any , 
231+       testClient , 
229232    )  as  SentryEvent ; 
230233
231234    expect ( enhancedEvent . contexts ) . toEqual ( { 
@@ -253,7 +256,7 @@ describe('ExtraErrorData()', () => {
253256      { 
254257        originalException : error , 
255258      } , 
256-       { }   as   any , 
259+       testClient , 
257260    )  as  SentryEvent ; 
258261
259262    expect ( enhancedEvent . contexts ) . toEqual ( { 
@@ -282,7 +285,7 @@ describe('ExtraErrorData()', () => {
282285      { 
283286        originalException : error , 
284287      } , 
285-       { }   as   any , 
288+       testClient , 
286289    )  as  SentryEvent ; 
287290
288291    expect ( enhancedEvent . contexts ) . not . toEqual ( { 
0 commit comments