11import * as SentryBrowser from '@sentry/browser' ;
22import { vi } from 'vitest' ;
3- import { getDefaultIntegrations , init } from '../src/index ' ;
3+ import { getDefaultIntegrations , init } from '../src/sdk ' ;
44
55describe ( 'init' , ( ) => {
66 it ( 'sets the Angular version (if available) in the global scope' , ( ) => {
@@ -14,39 +14,16 @@ describe('init', () => {
1414 expect ( setContextSpy ) . toHaveBeenCalledWith ( 'angular' , { version : 14 } ) ;
1515 } ) ;
1616
17- describe ( 'filtering out the `BrowserApiErrors` integration' , ( ) => {
18- const browserInitSpy = vi . spyOn ( SentryBrowser , 'init' ) ;
17+ it ( 'does not include the BrowserApiErrors integration' , ( ) => {
18+ const browserDefaultIntegrationsWithoutBrowserApiErrors = SentryBrowser . getDefaultIntegrations ( )
19+ . filter ( i => i . name !== 'BrowserApiErrors' )
20+ . map ( i => i . name )
21+ . sort ( ) ;
1922
20- beforeEach ( ( ) => {
21- browserInitSpy . mockClear ( ) ;
22- } ) ;
23+ const angularDefaultIntegrations = getDefaultIntegrations ( )
24+ . map ( i => i . name )
25+ . sort ( ) ;
2326
24- it ( 'filters if `defaultIntegrations` is not set' , ( ) => {
25- init ( { } ) ;
26-
27- expect ( browserInitSpy ) . toHaveBeenCalledTimes ( 1 ) ;
28-
29- const options = browserInitSpy . mock . calls [ 0 ] [ 0 ] || { } ;
30- expect ( options . defaultIntegrations ) . not . toContainEqual ( expect . objectContaining ( { name : 'BrowserApiErrors' } ) ) ;
31- } ) ;
32-
33- it ( "doesn't filter if `defaultIntegrations` is set to `false`" , ( ) => {
34- init ( { defaultIntegrations : false } ) ;
35-
36- expect ( browserInitSpy ) . toHaveBeenCalledTimes ( 1 ) ;
37-
38- const options = browserInitSpy . mock . calls [ 0 ] [ 0 ] || { } ;
39- expect ( options . defaultIntegrations ) . toEqual ( false ) ;
40- } ) ;
41-
42- it ( "doesn't filter if `defaultIntegrations` is overwritten" , ( ) => {
43- const defaultIntegrations = getDefaultIntegrations ( { } ) ;
44- init ( { defaultIntegrations } ) ;
45-
46- expect ( browserInitSpy ) . toHaveBeenCalledTimes ( 1 ) ;
47-
48- const options = browserInitSpy . mock . calls [ 0 ] [ 0 ] || { } ;
49- expect ( options . defaultIntegrations ) . toEqual ( defaultIntegrations ) ;
50- } ) ;
27+ expect ( angularDefaultIntegrations ) . toEqual ( browserDefaultIntegrationsWithoutBrowserApiErrors ) ;
5128 } ) ;
5229} ) ;
0 commit comments