11import { type Integration } from '@sentry/core' ;
2- import * as sentryNode from '@sentry/node ' ;
2+ import * as sentryServerUtils from '@sentry/server-utils ' ;
33import type { Mock } from 'bun:test' ;
44import { afterEach , beforeEach , describe , expect , it , mock , spyOn } from 'bun:test' ;
55import {
@@ -22,15 +22,14 @@ class MockIntegration implements Integration {
2222}
2323
2424describe ( 'init()' , ( ) => {
25- let mockAutoPerformanceIntegrations : Mock < ( ) => Integration [ ] > ;
25+ let mockGetTracingIntegrations : Mock < ( ) => Integration [ ] > ;
2626
2727 beforeEach ( ( ) => {
28- // @ts -expect-error weird
29- mockAutoPerformanceIntegrations = spyOn ( sentryNode , 'getAutoPerformanceIntegrations' ) ;
28+ mockGetTracingIntegrations = spyOn ( sentryServerUtils , 'getTracingIntegrations' ) ;
3029 } ) ;
3130
3231 afterEach ( ( ) => {
33- mockAutoPerformanceIntegrations . mockRestore ( ) ;
32+ mockGetTracingIntegrations . mockRestore ( ) ;
3433 } ) ;
3534
3635 describe ( 'integrations' , ( ) => {
@@ -41,7 +40,7 @@ describe('init()', () => {
4140
4241 expect ( client ?. getOptions ( ) . integrations ) . toEqual ( [ ] ) ;
4342
44- expect ( mockAutoPerformanceIntegrations ) . toHaveBeenCalledTimes ( 0 ) ;
43+ expect ( mockGetTracingIntegrations ) . toHaveBeenCalledTimes ( 0 ) ;
4544 } ) ;
4645
4746 it ( 'enables spotlight with default URL from config `true`' , ( ) => {
@@ -75,7 +74,7 @@ describe('init()', () => {
7574 expect ( mockDefaultIntegrations [ 1 ] ?. setupOnce ) . toHaveBeenCalledTimes ( 1 ) ;
7675 expect ( mockIntegrations [ 0 ] ?. setupOnce ) . toHaveBeenCalledTimes ( 1 ) ;
7776 expect ( mockIntegrations [ 1 ] ?. setupOnce ) . toHaveBeenCalledTimes ( 1 ) ;
78- expect ( mockAutoPerformanceIntegrations ) . toHaveBeenCalledTimes ( 0 ) ;
77+ expect ( mockGetTracingIntegrations ) . toHaveBeenCalledTimes ( 0 ) ;
7978 } ) ;
8079
8180 it ( 'installs integrations returned from a callback function' , ( ) => {
@@ -99,12 +98,12 @@ describe('init()', () => {
9998 expect ( mockDefaultIntegrations [ 0 ] ?. setupOnce ) . toHaveBeenCalledTimes ( 1 ) ;
10099 expect ( mockDefaultIntegrations [ 1 ] ?. setupOnce ) . toHaveBeenCalledTimes ( 0 ) ;
101100 expect ( newIntegration . setupOnce ) . toHaveBeenCalledTimes ( 1 ) ;
102- expect ( mockAutoPerformanceIntegrations ) . toHaveBeenCalledTimes ( 0 ) ;
101+ expect ( mockGetTracingIntegrations ) . toHaveBeenCalledTimes ( 0 ) ;
103102 } ) ;
104103
105104 it ( 'installs performance default instrumentations if tracing is enabled' , ( ) => {
106105 const autoPerformanceIntegrations = [ new MockIntegration ( 'Performance integration' ) ] ;
107- mockAutoPerformanceIntegrations . mockImplementation ( ( ) => autoPerformanceIntegrations ) ;
106+ mockGetTracingIntegrations . mockImplementation ( ( ) => autoPerformanceIntegrations ) ;
108107
109108 const mockIntegrations = [
110109 new MockIntegration ( 'Some mock integration 4.1' ) ,
@@ -120,7 +119,7 @@ describe('init()', () => {
120119 expect ( mockIntegrations [ 0 ] ?. setupOnce ) . toHaveBeenCalledTimes ( 1 ) ;
121120 expect ( mockIntegrations [ 1 ] ?. setupOnce ) . toHaveBeenCalledTimes ( 1 ) ;
122121 expect ( autoPerformanceIntegrations [ 0 ] ?. setupOnce ) . toHaveBeenCalledTimes ( 1 ) ;
123- expect ( mockAutoPerformanceIntegrations ) . toHaveBeenCalledTimes ( 1 ) ;
122+ expect ( mockGetTracingIntegrations ) . toHaveBeenCalledTimes ( 1 ) ;
124123
125124 const integrations = getClient ( ) ?. getOptions ( ) . integrations ;
126125 expect ( integrations ) . toBeArray ( ) ;
@@ -137,7 +136,7 @@ describe('init()', () => {
137136 const client = getClient ( ) ;
138137
139138 expect ( client ?. getOptions ( ) . integrations ) . toEqual ( [ ] ) ;
140- expect ( mockAutoPerformanceIntegrations ) . toHaveBeenCalledTimes ( 0 ) ;
139+ expect ( mockGetTracingIntegrations ) . toHaveBeenCalledTimes ( 0 ) ;
141140 } ) ;
142141
143142 it ( 'still installs user-provided integrations' , ( ) => {
@@ -162,12 +161,12 @@ describe('init()', () => {
162161 const full = getDefaultIntegrations ( { } ) . map ( ( { name } ) => name ) ;
163162
164163 expect ( withoutPerformance ) . toEqual ( full ) ;
165- expect ( mockAutoPerformanceIntegrations ) . toHaveBeenCalledTimes ( 0 ) ;
164+ expect ( mockGetTracingIntegrations ) . toHaveBeenCalledTimes ( 0 ) ;
166165 } ) ;
167166
168167 it ( 'omits the performance integrations that the full set adds when tracing is enabled' , ( ) => {
169168 const performanceIntegration = new MockIntegration ( 'Performance integration' ) ;
170- mockAutoPerformanceIntegrations . mockImplementation ( ( ) => [ performanceIntegration ] ) ;
169+ mockGetTracingIntegrations . mockImplementation ( ( ) => [ performanceIntegration ] ) ;
171170
172171 const withoutPerformance = getDefaultIntegrationsWithoutPerformance ( ) . map ( ( { name } ) => name ) ;
173172 const full = getDefaultIntegrations ( { tracesSampleRate : 1 } ) . map ( ( { name } ) => name ) ;
0 commit comments