File tree 2 files changed +7
-10
lines changed 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ const mockScope = {
18
18
setTag : jest . fn ( ) ,
19
19
setContext : jest . fn ( ) ,
20
20
addEventProcessor : jest . fn ( ) ,
21
+ setTransactionName : jest . fn ( ) ,
21
22
} ;
22
23
23
24
jest . mock ( '@sentry/node' , ( ) => {
@@ -81,12 +82,8 @@ const fakeCallback: Callback = (err, result) => {
81
82
} ;
82
83
83
84
function expectScopeSettings ( ) {
84
- expect ( mockScope . addEventProcessor ) . toBeCalledTimes ( 1 ) ;
85
- // Test than an event processor to add `transaction` is registered for the scope
86
- const eventProcessor = mockScope . addEventProcessor . mock . calls [ 0 ] [ 0 ] ;
87
- const event : Event = { } ;
88
- eventProcessor ( event ) ;
89
- expect ( event ) . toEqual ( { transaction : 'functionName' } ) ;
85
+ expect ( mockScope . setTransactionName ) . toBeCalledTimes ( 1 ) ;
86
+ expect ( mockScope . setTransactionName ) . toBeCalledWith ( 'functionName' ) ;
90
87
91
88
expect ( mockScope . setTag ) . toBeCalledWith ( 'server_name' , expect . anything ( ) ) ;
92
89
Original file line number Diff line number Diff line change @@ -342,12 +342,12 @@ export class Scope {
342
342
}
343
343
344
344
/**
345
- * Sets the transaction name on the scope so that the name of the transaction
346
- * (e.g. taken server route or page location) is attached to future events.
345
+ * Sets the transaction name on the scope so that the name of e.g. taken server route or
346
+ * the page location is attached to future events.
347
347
*
348
348
* IMPORTANT: Calling this function does NOT change the name of the currently active
349
- * span. If you want to change the name of the active span, use `span.updateName()`
350
- * instead.
349
+ * root span. If you want to change the name of the active root span, use
350
+ * `Sentry.updateSpanName(rootSpan, 'new name')` instead.
351
351
*
352
352
* By default, the SDK updates the scope's transaction name automatically on sensible
353
353
* occasions, such as a page navigation or when handling a new request on the server.
You can’t perform that action at this time.
0 commit comments