@@ -13,7 +13,7 @@ afterAll(() => {
1313 *
1414 * This test nevertheless covers the behavior so that we're aware.
1515 */
16- test ( 'applies withScope scope to thrown error' , done => {
16+ test ( 'withScope scope is NOT applied to thrown error caught by global handler ' , done => {
1717 const runner = createRunner ( __dirname , 'server.ts' )
1818 . ignore ( 'session' , 'sessions' )
1919 . expect ( {
@@ -49,3 +49,40 @@ test('applies withScope scope to thrown error', done => {
4949
5050 expect ( ( ) => runner . makeRequest ( 'get' , '/test/withScope' ) ) . rejects . toThrow ( ) ;
5151} ) ;
52+
53+ test ( 'isolation scope is applied to thrown error caught by global handler' , done => {
54+ const runner = createRunner ( __dirname , 'server.ts' )
55+ . ignore ( 'session' , 'sessions' )
56+ . expect ( {
57+ event : {
58+ exception : {
59+ values : [
60+ {
61+ mechanism : {
62+ type : 'middleware' ,
63+ handled : false ,
64+ } ,
65+ type : 'Error' ,
66+ value : 'isolation_test_error' ,
67+ stacktrace : {
68+ frames : expect . arrayContaining ( [
69+ expect . objectContaining ( {
70+ function : expect . any ( String ) ,
71+ lineno : expect . any ( Number ) ,
72+ colno : expect . any ( Number ) ,
73+ } ) ,
74+ ] ) ,
75+ } ,
76+ } ,
77+ ] ,
78+ } ,
79+ tags : {
80+ global : 'tag' ,
81+ 'isolation-scope' : 'tag' ,
82+ } ,
83+ } ,
84+ } )
85+ . start ( done ) ;
86+
87+ expect ( ( ) => runner . makeRequest ( 'get' , '/test/isolationScope' ) ) . rejects . toThrow ( ) ;
88+ } ) ;
0 commit comments