@@ -8,19 +8,26 @@ import {
8
8
shouldSkipTracingTest ,
9
9
} from '../../../../utils/helpers' ;
10
10
11
- sentryTest ( 'should capture an error within a sync startSpan callback' , async ( { getLocalTestPath, page } ) => {
12
- if ( shouldSkipTracingTest ( ) ) {
13
- sentryTest . skip ( ) ;
14
- }
11
+ sentryTest (
12
+ 'should capture an error within a sync startSpan callback' ,
13
+ async ( { getLocalTestPath, page, browserName } ) => {
14
+ if ( browserName === 'webkit' ) {
15
+ // This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry
16
+ sentryTest . skip ( ) ;
17
+ }
15
18
16
- const url = await getLocalTestPath ( { testDir : __dirname } ) ;
19
+ if ( shouldSkipTracingTest ( ) ) {
20
+ sentryTest . skip ( ) ;
21
+ }
17
22
18
- await page . goto ( url ) ;
23
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
19
24
20
- const errorEventsPromise = getMultipleSentryEnvelopeRequests < Event > ( page , 2 ) ;
25
+ await page . goto ( url ) ;
21
26
22
- runScriptInSandbox ( page , {
23
- content : `
27
+ const errorEventsPromise = getMultipleSentryEnvelopeRequests < Event > ( page , 2 ) ;
28
+
29
+ runScriptInSandbox ( page , {
30
+ content : `
24
31
function run() {
25
32
Sentry.startSpan({ name: 'parent_span' }, () => {
26
33
throw new Error('Sync Error');
@@ -29,13 +36,14 @@ sentryTest('should capture an error within a sync startSpan callback', async ({
29
36
30
37
setTimeout(run);
31
38
` ,
32
- } ) ;
39
+ } ) ;
33
40
34
- const events = await errorEventsPromise ;
41
+ const events = await errorEventsPromise ;
35
42
36
- const txn = events . find ( event => event . type === 'transaction' ) ;
37
- const err = events . find ( event => ! event . type ) ;
43
+ const txn = events . find ( event => event . type === 'transaction' ) ;
44
+ const err = events . find ( event => ! event . type ) ;
38
45
39
- expect ( txn ) . toMatchObject ( { transaction : 'parent_span' } ) ;
40
- expect ( err ?. exception ?. values ?. [ 0 ] ?. value ) . toBe ( 'Sync Error' ) ;
41
- } ) ;
46
+ expect ( txn ) . toMatchObject ( { transaction : 'parent_span' } ) ;
47
+ expect ( err ?. exception ?. values ?. [ 0 ] ?. value ) . toBe ( 'Sync Error' ) ;
48
+ } ,
49
+ ) ;
0 commit comments