File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,14 @@ export function getIntegrationsToSetup(options: Options): Integration[] {
4040 integrations = userIntegrations ( defaultIntegrations ) ;
4141 integrations = Array . isArray ( integrations ) ? integrations : [ integrations ] ;
4242 } else {
43- return [ ...defaultIntegrations ] ;
43+ integrations = [ ...defaultIntegrations ] ;
44+ }
45+
46+ // Make sure that if present, `Debug` integration will always run last
47+ const integrationsNames = integrations . map ( i => i . name ) ;
48+ const alwaysLastToRun = 'Debug' ;
49+ if ( integrationsNames . indexOf ( alwaysLastToRun ) !== - 1 ) {
50+ integrations . push ( ...integrations . splice ( integrationsNames . indexOf ( alwaysLastToRun ) , 1 ) ) ;
4451 }
4552
4653 return integrations ;
Original file line number Diff line number Diff line change @@ -122,4 +122,27 @@ describe('getIntegrationsToSetup', () => {
122122 expect ( ( integrations [ 0 ] as any ) . order ) . toEqual ( 'firstUser' ) ;
123123 expect ( ( integrations [ 1 ] as any ) . order ) . toEqual ( 'secondUser' ) ;
124124 } ) ;
125+
126+ it ( 'always moves Debug integration to the end of the list' , ( ) => {
127+ let integrations = getIntegrationsToSetup ( {
128+ defaultIntegrations : [ new MockIntegration ( 'Debug' ) , new MockIntegration ( 'foo' ) ] ,
129+ integrations : [ new MockIntegration ( 'bar' ) ] ,
130+ } ) ;
131+
132+ expect ( integrations . map ( i => i . name ) ) . toEqual ( [ 'foo' , 'bar' , 'Debug' ] ) ;
133+
134+ integrations = getIntegrationsToSetup ( {
135+ defaultIntegrations : [ new MockIntegration ( 'foo' ) ] ,
136+ integrations : [ new MockIntegration ( 'Debug' ) , new MockIntegration ( 'bar' ) ] ,
137+ } ) ;
138+
139+ expect ( integrations . map ( i => i . name ) ) . toEqual ( [ 'foo' , 'bar' , 'Debug' ] ) ;
140+
141+ integrations = getIntegrationsToSetup ( {
142+ defaultIntegrations : [ new MockIntegration ( 'Debug' ) ] ,
143+ integrations : [ new MockIntegration ( 'foo' ) ] ,
144+ } ) ;
145+
146+ expect ( integrations . map ( i => i . name ) ) . toEqual ( [ 'foo' , 'Debug' ] ) ;
147+ } ) ;
125148} ) ;
You can’t perform that action at this time.
0 commit comments