From 93fd9e7412bc0b080d9328b0a4209886cb3f0e8b Mon Sep 17 00:00:00 2001 From: Frans Date: Thu, 28 Oct 2021 16:45:12 -0600 Subject: [PATCH] fix: repaired CI (#7659) and added spec reporter --- spec/ParseLiveQuery.spec.js | 6 ++++-- spec/ParseUser.spec.js | 10 ++++++++-- spec/helper.js | 12 ++++++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/spec/ParseLiveQuery.spec.js b/spec/ParseLiveQuery.spec.js index e4ace5045f..e5858c9898 100644 --- a/spec/ParseLiveQuery.spec.js +++ b/spec/ParseLiveQuery.spec.js @@ -949,7 +949,7 @@ describe('ParseLiveQuery', function () { const response = (obj, prev) => { expect(obj.get('sessionToken')).toBeUndefined(); expect(obj.sessionToken).toBeUndefined(); - expect(prev?.sessionToken).toBeUndefined(); + expect(prev && prev.sessionToken).toBeUndefined(); if (prev && prev.get) { expect(prev.get('sessionToken')).toBeUndefined(); } @@ -967,8 +967,10 @@ 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 => process.nextTick(resolve)); + await new Promise(resolve => setTimeout(resolve, 500)); for (const key of events) { expect(calls[key]).toHaveBeenCalled(); } diff --git a/spec/ParseUser.spec.js b/spec/ParseUser.spec.js index 18ab1657b7..bcfbd07e2c 100644 --- a/spec/ParseUser.spec.js +++ b/spec/ParseUser.spec.js @@ -3948,7 +3948,7 @@ describe('Parse.User testing', () => { const response = (obj, prev) => { expect(obj.get('authData')).toBeUndefined(); expect(obj.authData).toBeUndefined(); - expect(prev?.authData).toBeUndefined(); + expect(prev && prev.authData).toBeUndefined(); if (prev && prev.get) { expect(prev.get('authData')).toBeUndefined(); } @@ -3967,11 +3967,17 @@ describe('Parse.User testing', () => { await user.save(); user.set('yolo', 'bar'); await user.save(); + user.unset('foo'); + await user.save(); await user.destroy(); - await new Promise(resolve => process.nextTick(resolve)); + await new Promise(resolve => setTimeout(resolve, 500)); 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)); }); describe('issue #4897', () => { diff --git a/spec/helper.js b/spec/helper.js index a7f6cf2280..af59a32182 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -2,6 +2,18 @@ // 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, + }, + }) +); + global.on_db = (db, callback, elseCallback) => { if (process.env.PARSE_SERVER_TEST_DB == db) { return callback();