jeudi 26 mars 2020

Timeout - Async callback was not invoked within the 5000ms timeout specified by jest

I have the following issue:

describe('asyncFunction', () => {
  test('test case', async () => {
    ...
    const x = await asyncFunction()
    ...
  })
})

But function:

async asyncFunction() {
  ...
  return await otherFunction().then(callback)
}

I tried to increment jest timeout but it didn't work... Here I've found other questions and answers and I've learned change timeout is not the answer, I must invoke a callback, but I don't understand, if otherFuncion returns an Object it won't be executed (that is actually what it happens to me, otherFunction is not being executed and I don't understand why).

Please, somebody help me to understand what happens here.

Aucun commentaire:

Enregistrer un commentaire