Cannot log after tests are done. Did you forget to wait for something async in your test?

Viewed 9154

I am getting this error:

Cannot log after tests are done. Did you forget to wait for something async in your test?

in my simple test code in test file.

I am using nodejs request module to make request and after callback i am logging the response which throws this warning.

Following is my test case I'm using.

    request.get(
        {
            url:"", headers
        }, (err, data) => {
            if(err) console.log(err)
            if(data.statusCode != 200) console.log(data.body)
            console.log(data.body)
            expect(data.statusCode).toBe(200)
    })
})
0 Answers
Related