File tree 2 files changed +31
-1
lines changed
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[] {
40
40
integrations = userIntegrations ( defaultIntegrations ) ;
41
41
integrations = Array . isArray ( integrations ) ? integrations : [ integrations ] ;
42
42
} 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 ) ) ;
44
51
}
45
52
46
53
return integrations ;
Original file line number Diff line number Diff line change @@ -122,4 +122,27 @@ describe('getIntegrationsToSetup', () => {
122
122
expect ( ( integrations [ 0 ] as any ) . order ) . toEqual ( 'firstUser' ) ;
123
123
expect ( ( integrations [ 1 ] as any ) . order ) . toEqual ( 'secondUser' ) ;
124
124
} ) ;
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
+ } ) ;
125
148
} ) ;
You can’t perform that action at this time.
0 commit comments