@@ -93,7 +93,7 @@ const defaultConfiguration = {
93
93
} ) ,
94
94
} ;
95
95
96
- const openConnections = { } ;
96
+ const openConnections = new Set ( ) ;
97
97
let parseServer ;
98
98
99
99
const shutdownServer = async _parseServer => {
@@ -138,10 +138,9 @@ const reconfigureServer = async (changedConfiguration = {}) => {
138
138
} ) ;
139
139
}
140
140
parseServer . server . on ( 'connection' , connection => {
141
- const key = `${ connection . remoteAddress } :${ connection . remotePort } ` ;
142
- openConnections [ key ] = connection ;
141
+ openConnections . add ( connection ) ;
143
142
connection . on ( 'close' , ( ) => {
144
- delete openConnections [ key ] ;
143
+ openConnections . delete ( connection ) ;
145
144
} ) ;
146
145
} ) ;
147
146
return parseServer ;
@@ -155,6 +154,7 @@ global.TestPoint = Parse.Object.extend('TestPoint');
155
154
global . TestObject = Parse . Object . extend ( 'TestObject' ) ;
156
155
global . reconfigureServer = reconfigureServer ;
157
156
global . shutdownServer = shutdownServer ;
157
+ global . openConnections = openConnections ;
158
158
159
159
beforeAll ( async ( ) => {
160
160
const promise = [ 'parse.js' , 'parse.min.js' ] . map ( fileName => {
@@ -179,11 +179,4 @@ afterEach(async () => {
179
179
}
180
180
} ) ;
181
181
182
- afterAll ( ( ) => {
183
- // Jasmine process counts as one open connection
184
- if ( Object . keys ( openConnections ) . length > 1 ) {
185
- console . warn ( 'There were open connections to the server left after the test finished' ) ;
186
- }
187
- } ) ;
188
-
189
182
module . exports = { twitterAuthData } ;
0 commit comments