diff --git a/package.json b/package.json index 4a0cd9928a2..83e9fd46511 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "form-data": "3.0.0", "husky": "4.2.5", "jasmine": "3.5.0", - "jasmine-spec-reporter": "^7.0.0", + "jasmine-spec-reporter": "7.0.0", "jsdoc": "3.6.7", "jsdoc-babel": "0.5.0", "lint-staged": "10.2.3", diff --git a/spec/ParseLiveQuery.spec.js b/spec/ParseLiveQuery.spec.js index 6b527b50f61..23545e88d2b 100644 --- a/spec/ParseLiveQuery.spec.js +++ b/spec/ParseLiveQuery.spec.js @@ -963,8 +963,6 @@ describe('ParseLiveQuery', function () { await user.save(); user.set('yolo', 'bar'); await user.save(); - user.set('foo', 'bar'); - await user.save(); await user.destroy(); await new Promise(resolve => setTimeout(resolve, 10)); for (const key of events) { diff --git a/spec/ParseUser.spec.js b/spec/ParseUser.spec.js index bcfbd07e2c8..6c02cae7cf3 100644 --- a/spec/ParseUser.spec.js +++ b/spec/ParseUser.spec.js @@ -3960,24 +3960,21 @@ describe('Parse.User testing', () => { subscription.on(key, calls[key]); } const user = await Parse.User._logInWith('facebook'); - user.set('foo', 'bar'); await user.save(); user.unset('foo'); await user.save(); user.set('yolo', 'bar'); await user.save(); - user.unset('foo'); - await user.save(); await user.destroy(); - await new Promise(resolve => setTimeout(resolve, 500)); + await new Promise(resolve => setTimeout(resolve, 10)); for (const key of events) { expect(calls[key]).toHaveBeenCalled(); } subscription.unsubscribe(); const client = await Parse.CoreManager.getLiveQueryController().getDefaultLiveQueryClient(); client.close(); - await new Promise(resolve => setTimeout(resolve, 500)); + await new Promise(resolve => setTimeout(resolve, 10)); }); describe('issue #4897', () => { diff --git a/spec/helper.js b/spec/helper.js index af59a321826..d9e9b77797c 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -1,18 +1,11 @@ 'use strict'; +const CurrentSpecReporter = require('./support/CurrentSpecReporter.js'); +const { SpecReporter } = require('jasmine-spec-reporter'); + // Sets up a Parse API server for testing. jasmine.DEFAULT_TIMEOUT_INTERVAL = process.env.PARSE_SERVER_TEST_TIMEOUT || 5000; - -const SpecReporter = require('jasmine-spec-reporter').SpecReporter; - -jasmine.getEnv().clearReporters(); // remove default reporter logs -jasmine.getEnv().addReporter( - new SpecReporter({ - // add jasmine-spec-reporter - spec: { - displayPending: true, - }, - }) -); +jasmine.getEnv().addReporter(new CurrentSpecReporter()); +jasmine.getEnv().addReporter(new SpecReporter()); global.on_db = (db, callback, elseCallback) => { if (process.env.PARSE_SERVER_TEST_DB == db) { diff --git a/spec/support/CurrentSpecReporter.js b/spec/support/CurrentSpecReporter.js new file mode 100644 index 00000000000..3158e21eae2 --- /dev/null +++ b/spec/support/CurrentSpecReporter.js @@ -0,0 +1,15 @@ +// Sets a global variable to the current test spec +// ex: global.currentSpec.description + +global.currentSpec = null; + +class CurrentSpecReporter { + specStarted(spec) { + global.currentSpec = spec; + } + specDone() { + global.currentSpec = null; + } +} + +module.exports = CurrentSpecReporter;