@@ -98,16 +98,6 @@ function makeNodeTransport(options: BaseTransportOptions) {
98
98
return createTransport ( options , requestExecutor ) ;
99
99
}
100
100
101
- /**
102
- * global.__SENTRY_INTERCEPT_TRANSPORT__ is used for testing purposes. If it is
103
- * set as an array, the transport will push envelopes to it instead of sending them.
104
- */
105
- function getGlobalWithInterceptor ( ) : typeof global & {
106
- __SENTRY_INTERCEPT_TRANSPORT__ ?: unknown [ ] ;
107
- } {
108
- return global ;
109
- }
110
-
111
101
/** A transports that does nothing */
112
102
export function makeOptionallyEnabledNodeTransport (
113
103
shouldSendTelemetry : Promise < boolean >
@@ -117,10 +107,13 @@ export function makeOptionallyEnabledNodeTransport(
117
107
return {
118
108
flush : ( timeout ) => nodeTransport . flush ( timeout ) ,
119
109
send : async ( request ) => {
120
- // Allow intercepting enveloped for testing
121
- const gbl = getGlobalWithInterceptor ( ) ;
122
- if ( gbl . __SENTRY_INTERCEPT_TRANSPORT__ ) {
123
- gbl . __SENTRY_INTERCEPT_TRANSPORT__ . push ( request ) ;
110
+ // If global.__SENTRY_INTERCEPT_TRANSPORT__ is an array, we push the
111
+ // envelope into it for testing purposes.
112
+ if (
113
+ "__SENTRY_INTERCEPT_TRANSPORT__" in global &&
114
+ Array . isArray ( global . __SENTRY_INTERCEPT_TRANSPORT__ )
115
+ ) {
116
+ global . __SENTRY_INTERCEPT_TRANSPORT__ . push ( request ) ;
124
117
return { statusCode : 200 } ;
125
118
}
126
119
0 commit comments