@@ -95,8 +95,6 @@ describe('AWSLambda', () => {
95
95
} ) ;
96
96
97
97
test ( 'captureTimeoutWarning enabled (default)' , async ( ) => {
98
- expect . assertions ( 2 ) ;
99
-
100
98
const handler : Handler = ( _event , _context , callback ) => {
101
99
setTimeout ( ( ) => {
102
100
callback ( null , 42 ) ;
@@ -105,14 +103,13 @@ describe('AWSLambda', () => {
105
103
const wrappedHandler = wrapHandler ( handler ) ;
106
104
await wrappedHandler ( fakeEvent , fakeContext , fakeCallback ) ;
107
105
106
+ expect ( Sentry . withScope ) . toBeCalledTimes ( 2 ) ;
108
107
expect ( Sentry . captureMessage ) . toBeCalled ( ) ;
109
108
// @ts -expect-error see "Why @ts-expect-error" note
110
109
expect ( SentryNode . fakeScope . setTag ) . toBeCalledWith ( 'timeout' , '1s' ) ;
111
110
} ) ;
112
111
113
112
test ( 'captureTimeoutWarning disabled' , async ( ) => {
114
- expect . assertions ( 2 ) ;
115
-
116
113
const handler : Handler = ( _event , _context , callback ) => {
117
114
setTimeout ( ( ) => {
118
115
callback ( null , 42 ) ;
@@ -123,8 +120,10 @@ describe('AWSLambda', () => {
123
120
} ) ;
124
121
await wrappedHandler ( fakeEvent , fakeContext , fakeCallback ) ;
125
122
126
- expect ( Sentry . withScope ) . not . toBeCalled ( ) ;
123
+ expect ( Sentry . withScope ) . toBeCalledTimes ( 1 ) ;
127
124
expect ( Sentry . captureMessage ) . not . toBeCalled ( ) ;
125
+ // @ts -expect-error see "Why @ts-expect-error" note
126
+ expect ( SentryNode . fakeScope . setTag ) . not . toBeCalledWith ( 'timeout' , '1s' ) ;
128
127
} ) ;
129
128
130
129
test ( 'captureTimeoutWarning with configured timeoutWarningLimit' , async ( ) => {
0 commit comments