@@ -189,7 +189,7 @@ describe('Cloud Code Logger', () => {
189189 } ) ;
190190 } ) ;
191191
192- it_id ( '8088de8a-7cba-4035-8b05-4a903307e674' ) ( it ) ( 'should log cloud function execution using the custom log level' , async done => {
192+ it_id ( '8088de8a-7cba-4035-8b05-4a903307e674' ) ( it ) ( 'should log cloud function execution using the custom log level' , async ( ) => {
193193 Parse . Cloud . define ( 'aFunction' , ( ) => {
194194 return 'it worked!' ;
195195 } ) ;
@@ -203,6 +203,7 @@ describe('Cloud Code Logger', () => {
203203 expect ( log ) . toEqual ( 'info' ) ;
204204 } ) ;
205205
206+ Parse . Cloud . _removeAllHooks ( ) ;
206207 await reconfigureServer ( {
207208 silent : true ,
208209 logLevels : {
@@ -211,6 +212,10 @@ describe('Cloud Code Logger', () => {
211212 } ,
212213 } ) ;
213214
215+ Parse . Cloud . define ( 'bFunction' , ( ) => {
216+ throw new Error ( 'Failed' ) ;
217+ } ) ;
218+
214219 spy = spyOn ( Config . get ( 'test' ) . loggerController . adapter , 'log' ) . and . callThrough ( ) ;
215220
216221 try {
@@ -221,15 +226,12 @@ describe('Cloud Code Logger', () => {
221226 . allArgs ( )
222227 . find ( log => log [ 1 ] . startsWith ( 'Failed running cloud function bFunction for ' ) ) ?. [ 0 ] ;
223228 expect ( log ) . toEqual ( 'info' ) ;
224- done ( ) ;
225229 }
226230 } ) ;
227231
228232 it ( 'should log cloud function triggers using the custom log level' , async ( ) => {
229- Parse . Cloud . beforeSave ( 'TestClass' , ( ) => { } ) ;
230- Parse . Cloud . afterSave ( 'TestClass' , ( ) => { } ) ;
231-
232233 const execTest = async ( logLevel , triggerBeforeSuccess , triggerAfter ) => {
234+ Parse . Cloud . _removeAllHooks ( ) ;
233235 await reconfigureServer ( {
234236 silent : true ,
235237 logLevel,
@@ -239,6 +241,9 @@ describe('Cloud Code Logger', () => {
239241 } ,
240242 } ) ;
241243
244+ Parse . Cloud . beforeSave ( 'TestClass' , ( ) => { } ) ;
245+ Parse . Cloud . afterSave ( 'TestClass' , ( ) => { } ) ;
246+
242247 spy = spyOn ( Config . get ( 'test' ) . loggerController . adapter , 'log' ) . and . callThrough ( ) ;
243248 const obj = new Parse . Object ( 'TestClass' ) ;
244249 await obj . save ( ) ;
@@ -344,6 +349,7 @@ describe('Cloud Code Logger', () => {
344349 } ) ;
345350
346351 it ( 'should log cloud function execution using the silent log level' , async ( ) => {
352+ Parse . Cloud . _removeAllHooks ( ) ;
347353 await reconfigureServer ( {
348354 logLevels : {
349355 cloudFunctionSuccess : 'silent' ,
@@ -367,6 +373,7 @@ describe('Cloud Code Logger', () => {
367373 } ) ;
368374
369375 it ( 'should log cloud function triggers using the silent log level' , async ( ) => {
376+ Parse . Cloud . _removeAllHooks ( ) ;
370377 await reconfigureServer ( {
371378 logLevels : {
372379 triggerAfter : 'silent' ,
0 commit comments