@@ -9,7 +9,7 @@ import { NodeClient } from '../../src/client';
99import { Http as HttpIntegration } from '../../src/integrations/http' ;
1010
1111describe ( 'tracing' , ( ) => {
12- function createTransactionOnScope ( ) {
12+ function createTransactionOnScope ( ) : Transaction {
1313 const hub = new Hub (
1414 new NodeClient ( {
1515 dsn :
'https://[email protected] /12312012' , @@ -24,7 +24,10 @@ describe('tracing', () => {
2424 jest . spyOn ( sentryCore , 'getCurrentHub' ) . mockReturnValue ( hub ) ;
2525 jest . spyOn ( hubModule , 'getCurrentHub' ) . mockReturnValue ( hub ) ;
2626
27- const transaction = hub . startTransaction ( { name : 'dogpark' } ) ;
27+ // we have to cast this to a Transaction (the class) because hub.startTransaction only returns a Transaction (the
28+ // interface, which doesn't have things like spanRecorder) (and because @sentry/hub can't depend on @sentry/tracing,
29+ // we can't fix that)
30+ const transaction = hub . startTransaction ( { name : 'dogpark' } ) as Transaction ;
2831 hub . getScope ( ) ?. setSpan ( transaction ) ;
2932
3033 return transaction ;
@@ -36,7 +39,7 @@ describe('tracing', () => {
3639 . reply ( 200 ) ;
3740
3841 const transaction = createTransactionOnScope ( ) ;
39- const spans = ( transaction as Span ) . spanRecorder ?. spans as Span [ ] ;
42+ const spans = transaction . spanRecorder ?. spans as Span [ ] ;
4043
4144 http . get ( 'http://dogs.are.great/' ) ;
4245
@@ -55,7 +58,7 @@ describe('tracing', () => {
5558 . reply ( 200 ) ;
5659
5760 const transaction = createTransactionOnScope ( ) ;
58- const spans = ( transaction as Span ) . spanRecorder ?. spans as Span [ ] ;
61+ const spans = transaction . spanRecorder ?. spans as Span [ ] ;
5962
6063 http . get ( 'http://squirrelchasers.ingest.sentry.io/api/12312012/store/' ) ;
6164
0 commit comments