Skip to content

Commit db8018d

Browse files
committed
fixes tests
1 parent 09b7b19 commit db8018d

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

integration/test/helper.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;
22

3+
const { SpecReporter } = require('jasmine-spec-reporter');
4+
jasmine.getEnv().addReporter(new SpecReporter());
5+
36
const ParseServer = require('parse-server').default;
47
const CustomAuth = require('./CustomAuth');
58
const sleep = require('./sleep');
@@ -9,6 +12,7 @@ const Parse = require('../../node');
912
const port = 1337;
1013
const mountPath = '/parse';
1114
const serverURL = 'http://localhost:1337/parse';
15+
let didChangeConfiguration = false;
1216

1317
const defaultConfiguration = {
1418
databaseURI: 'mongodb://localhost:27017/integration',
@@ -68,7 +72,7 @@ const destroyAliveConnections = function () {
6872
let parseServer;
6973
let 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;
124129
beforeAll(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
});

package-lock.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"husky": "4.3.5",
7070
"jasmine": "3.5.0",
7171
"jasmine-reporters": "2.3.2",
72+
"jasmine-spec-reporter": "6.0.0",
7273
"jest": "24.9.0",
7374
"jsdoc": "3.6.3",
7475
"jsdoc-babel": "0.5.0",

0 commit comments

Comments
 (0)