@@ -2,8 +2,7 @@ import * as os from 'os';
2
2
import { ProxyTracer } from '@opentelemetry/api' ;
3
3
import * as opentelemetryInstrumentationPackage from '@opentelemetry/instrumentation' ;
4
4
import type { Event , EventHint } from '@sentry/core' ;
5
- import { SDK_VERSION , getCurrentScope , getGlobalScope , getIsolationScope } from '@sentry/core' ;
6
-
5
+ import { SDK_VERSION , Scope , getCurrentScope , getGlobalScope , getIsolationScope } from '@sentry/core' ;
7
6
import { setOpenTelemetryContextAsyncContextStrategy } from '@sentry/opentelemetry' ;
8
7
import { NodeClient } from '../../src' ;
9
8
import { getDefaultNodeClientOptions } from '../helpers/getDefaultNodeClientOptions' ;
@@ -65,13 +64,16 @@ describe('NodeClient', () => {
65
64
} ) ;
66
65
67
66
describe ( '_prepareEvent' , ( ) => {
67
+ const currentScope = new Scope ( ) ;
68
+ const isolationScope = new Scope ( ) ;
69
+
68
70
test ( 'adds platform to event' , ( ) => {
69
71
const options = getDefaultNodeClientOptions ( { } ) ;
70
72
const client = new NodeClient ( options ) ;
71
73
72
74
const event : Event = { } ;
73
75
const hint : EventHint = { } ;
74
- client [ '_prepareEvent' ] ( event , hint ) ;
76
+ client [ '_prepareEvent' ] ( event , hint , currentScope , isolationScope ) ;
75
77
76
78
expect ( event . platform ) . toEqual ( 'node' ) ;
77
79
} ) ;
@@ -82,7 +84,7 @@ describe('NodeClient', () => {
82
84
83
85
const event : Event = { } ;
84
86
const hint : EventHint = { } ;
85
- client [ '_prepareEvent' ] ( event , hint ) ;
87
+ client [ '_prepareEvent' ] ( event , hint , currentScope , isolationScope ) ;
86
88
87
89
expect ( event . contexts ?. runtime ) . toEqual ( {
88
90
name : 'node' ,
@@ -96,7 +98,7 @@ describe('NodeClient', () => {
96
98
97
99
const event : Event = { } ;
98
100
const hint : EventHint = { } ;
99
- client [ '_prepareEvent' ] ( event , hint ) ;
101
+ client [ '_prepareEvent' ] ( event , hint , currentScope , isolationScope ) ;
100
102
101
103
expect ( event . server_name ) . toEqual ( 'foo' ) ;
102
104
} ) ;
@@ -108,7 +110,7 @@ describe('NodeClient', () => {
108
110
109
111
const event : Event = { } ;
110
112
const hint : EventHint = { } ;
111
- client [ '_prepareEvent' ] ( event , hint ) ;
113
+ client [ '_prepareEvent' ] ( event , hint , currentScope , isolationScope ) ;
112
114
113
115
expect ( event . server_name ) . toEqual ( 'foo' ) ;
114
116
@@ -121,7 +123,7 @@ describe('NodeClient', () => {
121
123
122
124
const event : Event = { } ;
123
125
const hint : EventHint = { } ;
124
- client [ '_prepareEvent' ] ( event , hint ) ;
126
+ client [ '_prepareEvent' ] ( event , hint , currentScope , isolationScope ) ;
125
127
126
128
expect ( event . server_name ) . toEqual ( os . hostname ( ) ) ;
127
129
} ) ;
@@ -132,7 +134,7 @@ describe('NodeClient', () => {
132
134
133
135
const event : Event = { contexts : { runtime : { name : 'foo' , version : '1.2.3' } } } ;
134
136
const hint : EventHint = { } ;
135
- client [ '_prepareEvent' ] ( event , hint ) ;
137
+ client [ '_prepareEvent' ] ( event , hint , currentScope , isolationScope ) ;
136
138
137
139
expect ( event . contexts ?. runtime ) . toEqual ( { name : 'foo' , version : '1.2.3' } ) ;
138
140
expect ( event . contexts ?. runtime ) . not . toEqual ( { name : 'node' , version : process . version } ) ;
@@ -144,7 +146,7 @@ describe('NodeClient', () => {
144
146
145
147
const event : Event = { server_name : 'foo' } ;
146
148
const hint : EventHint = { } ;
147
- client [ '_prepareEvent' ] ( event , hint ) ;
149
+ client [ '_prepareEvent' ] ( event , hint , currentScope , isolationScope ) ;
148
150
149
151
expect ( event . server_name ) . toEqual ( 'foo' ) ;
150
152
expect ( event . server_name ) . not . toEqual ( 'bar' ) ;
0 commit comments