@@ -87,11 +87,13 @@ describe('config', () => {
87
87
expect ( config . exporters [ 0 ] . _url . toString ( ) ) . to . equal ( options . url )
88
88
expect ( config . exporters [ 1 ] ) . to . be . an . instanceof ( FileExporter )
89
89
expect ( config . profilers ) . to . be . an ( 'array' )
90
- expect ( config . profilers . length ) . to . equal ( 3 )
90
+ expect ( config . profilers . length ) . to . equal ( 2 + samplingContextsAvailable )
91
91
expect ( config . profilers [ 0 ] ) . to . be . an . instanceOf ( SpaceProfiler )
92
92
expect ( config . profilers [ 1 ] ) . to . be . an . instanceOf ( WallProfiler )
93
93
expect ( config . profilers [ 1 ] . codeHotspotsEnabled ( ) ) . false
94
- expect ( config . profilers [ 2 ] ) . to . be . an . instanceOf ( EventsProfiler )
94
+ if ( samplingContextsAvailable ) {
95
+ expect ( config . profilers [ 2 ] ) . to . be . an . instanceOf ( EventsProfiler )
96
+ }
95
97
} )
96
98
97
99
it ( 'should filter out invalid profilers' , ( ) => {
@@ -147,10 +149,12 @@ describe('config', () => {
147
149
const config = new Config ( options )
148
150
149
151
expect ( config . profilers ) . to . be . an ( 'array' )
150
- expect ( config . profilers . length ) . to . equal ( 2 )
152
+ expect ( config . profilers . length ) . to . equal ( 1 + samplingContextsAvailable )
151
153
expect ( config . profilers [ 0 ] ) . to . be . an . instanceOf ( WallProfiler )
152
154
expect ( config . profilers [ 0 ] . codeHotspotsEnabled ( ) ) . to . equal ( samplingContextsAvailable )
153
- expect ( config . profilers [ 1 ] ) . to . be . an . instanceOf ( EventsProfiler )
155
+ if ( samplingContextsAvailable ) {
156
+ expect ( config . profilers [ 1 ] ) . to . be . an . instanceOf ( EventsProfiler )
157
+ }
154
158
expect ( config . v8ProfilerBugWorkaroundEnabled ) . false
155
159
expect ( config . cpuProfilingEnabled ) . to . equal ( samplingContextsAvailable )
156
160
} )
@@ -184,9 +188,11 @@ describe('config', () => {
184
188
const config = new Config ( options )
185
189
186
190
expect ( config . profilers ) . to . be . an ( 'array' )
187
- expect ( config . profilers . length ) . to . equal ( 2 )
191
+ expect ( config . profilers . length ) . to . equal ( 1 + samplingContextsAvailable )
188
192
expect ( config . profilers [ 0 ] ) . to . be . an . instanceOf ( WallProfiler )
189
- expect ( config . profilers [ 1 ] ) . to . be . an . instanceOf ( EventsProfiler )
193
+ if ( samplingContextsAvailable ) {
194
+ expect ( config . profilers [ 1 ] ) . to . be . an . instanceOf ( EventsProfiler )
195
+ }
190
196
} )
191
197
192
198
it ( 'should prioritize options over env variables' , ( ) => {
0 commit comments