11jasmine . DEFAULT_TIMEOUT_INTERVAL = 20000 ;
22
3+ const { SpecReporter } = require ( 'jasmine-spec-reporter' ) ;
4+ jasmine . getEnv ( ) . addReporter ( new SpecReporter ( ) ) ;
5+
36const ParseServer = require ( 'parse-server' ) . default ;
47const CustomAuth = require ( './CustomAuth' ) ;
58const sleep = require ( './sleep' ) ;
@@ -9,6 +12,7 @@ const Parse = require('../../node');
912const port = 1337 ;
1013const mountPath = '/parse' ;
1114const serverURL = 'http://localhost:1337/parse' ;
15+ let didChangeConfiguration = false ;
1216
1317const defaultConfiguration = {
1418 databaseURI : 'mongodb://localhost:27017/integration' ,
@@ -68,7 +72,7 @@ const destroyAliveConnections = function () {
6872let parseServer ;
6973let server ;
7074
71- const reconfigureServer = changedConfiguration => {
75+ const reconfigureServer = ( changedConfiguration = { } ) => {
7276 return new Promise ( ( resolve , reject ) => {
7377 if ( server ) {
7478 return parseServer . handleShutdown ( ) . then ( ( ) => {
@@ -80,6 +84,7 @@ const reconfigureServer = changedConfiguration => {
8084 } ) ;
8185 }
8286 try {
87+ didChangeConfiguration = Object . keys ( changedConfiguration ) . length !== 0 ;
8388 const newConfiguration = Object . assign ( { } , defaultConfiguration , changedConfiguration || { } , {
8489 serverStartComplete : error => {
8590 if ( error ) {
@@ -124,7 +129,7 @@ global.reconfigureServer = reconfigureServer;
124129beforeAll ( async ( ) => {
125130 await reconfigureServer ( ) ;
126131 Parse . initialize ( 'integration' ) ;
127- Parse . CoreManager . set ( 'SERVER_URL' , 'http://localhost:1337/parse' ) ;
132+ Parse . CoreManager . set ( 'SERVER_URL' , serverURL ) ;
128133 Parse . CoreManager . set ( 'MASTER_KEY' , 'notsosecret' ) ;
129134} ) ;
130135
@@ -135,4 +140,7 @@ afterEach(async () => {
135140 destroyAliveConnections ( ) ;
136141 // Connection close events are not immediate on node 10+... wait a bit
137142 await sleep ( 0 ) ;
143+ if ( didChangeConfiguration ) {
144+ await reconfigureServer ( ) ;
145+ }
138146} ) ;
0 commit comments