1
1
jasmine . DEFAULT_TIMEOUT_INTERVAL = 20000 ;
2
2
3
+ const { SpecReporter } = require ( 'jasmine-spec-reporter' ) ;
4
+ jasmine . getEnv ( ) . addReporter ( new SpecReporter ( ) ) ;
5
+
3
6
const ParseServer = require ( 'parse-server' ) . default ;
4
7
const CustomAuth = require ( './CustomAuth' ) ;
5
8
const sleep = require ( './sleep' ) ;
@@ -9,6 +12,7 @@ const Parse = require('../../node');
9
12
const port = 1337 ;
10
13
const mountPath = '/parse' ;
11
14
const serverURL = 'http://localhost:1337/parse' ;
15
+ let didChangeConfiguration = false ;
12
16
13
17
const defaultConfiguration = {
14
18
databaseURI : 'mongodb://localhost:27017/integration' ,
@@ -68,7 +72,7 @@ const destroyAliveConnections = function () {
68
72
let parseServer ;
69
73
let server ;
70
74
71
- const reconfigureServer = changedConfiguration => {
75
+ const reconfigureServer = ( changedConfiguration = { } ) => {
72
76
return new Promise ( ( resolve , reject ) => {
73
77
if ( server ) {
74
78
return parseServer . handleShutdown ( ) . then ( ( ) => {
@@ -80,6 +84,7 @@ const reconfigureServer = changedConfiguration => {
80
84
} ) ;
81
85
}
82
86
try {
87
+ didChangeConfiguration = Object . keys ( changedConfiguration ) . length !== 0 ;
83
88
const newConfiguration = Object . assign ( { } , defaultConfiguration , changedConfiguration || { } , {
84
89
serverStartComplete : error => {
85
90
if ( error ) {
@@ -124,7 +129,7 @@ global.reconfigureServer = reconfigureServer;
124
129
beforeAll ( async ( ) => {
125
130
await reconfigureServer ( ) ;
126
131
Parse . initialize ( 'integration' ) ;
127
- Parse . CoreManager . set ( 'SERVER_URL' , 'http://localhost:1337/parse' ) ;
132
+ Parse . CoreManager . set ( 'SERVER_URL' , serverURL ) ;
128
133
Parse . CoreManager . set ( 'MASTER_KEY' , 'notsosecret' ) ;
129
134
} ) ;
130
135
@@ -135,4 +140,7 @@ afterEach(async () => {
135
140
destroyAliveConnections ( ) ;
136
141
// Connection close events are not immediate on node 10+... wait a bit
137
142
await sleep ( 0 ) ;
143
+ if ( didChangeConfiguration ) {
144
+ await reconfigureServer ( ) ;
145
+ }
138
146
} ) ;
0 commit comments