11import * as SentryBrowser from '@sentry/browser' ;
22import * as SentryCore from '@sentry/core' ;
3- import type { Span } from '@sentry/core' ;
43import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN , SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core' ;
5- import type { SpanAttributes } from '@sentry/types' ;
4+ import type { Span , SpanAttributes } from '@sentry/types' ;
65
76import type { Route } from '../src/router' ;
87import { instrumentVueRouter } from '../src/router' ;
@@ -129,12 +128,13 @@ describe('instrumentVueRouter()', () => {
129128 'should return instrumentation that instruments VueRouter.beforeEach(%s, %s) for pageloads' ,
130129 ( fromKey , toKey , transactionName , transactionSource ) => {
131130 const mockRootSpan = {
131+ getSpanJSON : jest . fn ( ) . mockReturnValue ( { op : 'pageload' } ) ,
132132 updateName : jest . fn ( ) ,
133133 setAttribute : jest . fn ( ) ,
134134 setAttributes : jest . fn ( ) ,
135135 } ;
136136
137- jest . spyOn ( SentryCore , 'getRootSpan' ) . mockImplementation ( ( ) => mockRootSpan as unknown as Span ) ;
137+ const spy = jest . spyOn ( SentryCore , 'getRootSpan' ) . mockImplementation ( ( ) => mockRootSpan as unknown as Span ) ;
138138
139139 const mockStartSpan = jest . fn ( ) . mockImplementation ( _ => {
140140 return mockRootSpan ;
@@ -227,7 +227,8 @@ describe('instrumentVueRouter()', () => {
227227 setAttribute : jest . fn ( ) ,
228228 setAttributes : jest . fn ( ) ,
229229 name : '' ,
230- toJSON : ( ) => ( {
230+ getSpanJSON : ( ) => ( {
231+ op : 'pageload' ,
231232 data : {
232233 [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : 'url' ,
233234 } ,
@@ -250,7 +251,8 @@ describe('instrumentVueRouter()', () => {
250251 // now we give the transaction a custom name, thereby simulating what would
251252 // happen when users use the `beforeNavigate` hook
252253 mockRootSpan . name = 'customTxnName' ;
253- mockRootSpan . toJSON = ( ) => ( {
254+ mockRootSpan . getSpanJSON = ( ) => ( {
255+ op : 'pageload' ,
254256 data : {
255257 [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : 'custom' ,
256258 } ,
@@ -287,6 +289,7 @@ describe('instrumentVueRouter()', () => {
287289 setAttributes : jest . fn ( ) ,
288290 name : '' ,
289291 toJSON : ( ) => ( {
292+ op : 'pageload' ,
290293 data : {
291294 [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : 'url' ,
292295 } ,
0 commit comments