@@ -114,7 +114,7 @@ describe('Vue Tracing Mixins', () => {
114
114
} ) ;
115
115
116
116
describe ( 'Root Component Behavior' , ( ) => {
117
- it ( 'should always create root span for root component regardless of tracking options' , ( ) => {
117
+ it ( 'should always create a span for the Vue root component regardless of tracking options' , ( ) => {
118
118
const mixins = createTracingMixins ( { trackComponents : false } ) ;
119
119
120
120
mixins . beforeMount . call ( mockRootInstance ) ;
@@ -208,28 +208,30 @@ describe('Vue Tracing Mixins', () => {
208
208
} ) ;
209
209
210
210
describe ( 'Component Tracking Options' , ( ) => {
211
- it ( 'should respect tracking configuration options' , ( ) => {
212
- // Test different tracking configurations with the same component
213
- const runTracingTest = ( trackComponents : boolean | string [ ] | undefined , shouldTrack : boolean ) => {
214
- vi . clearAllMocks ( ) ;
215
- const mixins = createTracingMixins ( { trackComponents } ) ;
216
- mixins . beforeMount . call ( mockVueInstance ) ;
217
-
218
- if ( shouldTrack ) {
219
- expect ( startInactiveSpan ) . toHaveBeenCalled ( ) ;
220
- } else {
221
- expect ( startInactiveSpan ) . not . toHaveBeenCalled ( ) ;
222
- }
223
- } ;
211
+ it . each ( [
212
+ { trackComponents : undefined , expected : false , description : 'defaults to not tracking components' } ,
213
+ { trackComponents : false , expected : false , description : 'does not track when explicitly disabled' } ,
214
+ ] ) ( '$description' , ( { trackComponents } ) => {
215
+ const mixins = createTracingMixins ( { trackComponents } ) ;
216
+ mixins . beforeMount . call ( mockVueInstance ) ;
217
+ expect ( startInactiveSpan ) . not . toHaveBeenCalled ( ) ;
218
+ } ) ;
224
219
225
- // Test all tracking configurations
226
- runTracingTest ( undefined , false ) ; // Default - don't track
227
- runTracingTest ( false , false ) ; // Explicitly disabled
228
- runTracingTest ( true , true ) ; // Track all components
229
- runTracingTest ( [ 'TestComponent' ] , true ) ; // Track by name (match)
220
+ it . each ( [
221
+ { trackComponents : true , description : 'tracks all components when enabled' } ,
222
+ { trackComponents : [ 'TestComponent' ] , description : 'tracks components that match the name list' } ,
223
+ ] ) ( '$description' , ( { trackComponents } ) => {
224
+ const mixins = createTracingMixins ( { trackComponents } ) ;
225
+ mixins . beforeMount . call ( mockVueInstance ) ;
226
+ expect ( startInactiveSpan ) . toHaveBeenCalledWith (
227
+ expect . objectContaining ( {
228
+ name : 'Vue TestComponent' ,
229
+ op : 'ui.vue.mount' ,
230
+ } ) ,
231
+ ) ;
232
+ } ) ;
230
233
231
- // Test component not in tracking list
232
- vi . clearAllMocks ( ) ;
234
+ it ( 'does not track components not in the tracking list' , ( ) => {
233
235
const mixins = createTracingMixins ( { trackComponents : [ 'OtherComponent' ] } ) ;
234
236
mixins . beforeMount . call ( mockVueInstance ) ; // TestComponent
235
237
expect ( startInactiveSpan ) . not . toHaveBeenCalled ( ) ;
0 commit comments