I have problem with api-testing with jest
What is the current behavior?
Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.
at ../../../../Users/chhoeurng.sakona/AppData/Roaming/npm/node_modules/jest-cli/node_modules/jest-jasmine2/build/queue_runner.js:68:21
My current code
it ('GET should return a status of 200 OK', function (done) {
frisby
.get('url-api')
.expect('status', 200)
.done(done);
});
What is the current behavior?
It should work normally and no error.
Please provide your exact Jest configuration
I do not have configuration
Run npx envinfo --preset jest
in your project directory and paste the
results here
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
Binaries:
Node: 8.11.1
Yarn: Not Found
npm: 5.6.0
jest v22.4.3
You need to return a promise or use an async function when woking with promises:
it ('GET should return a status of 200 OK', async() => {
await frisby
.get('url-api')
.expect('status', 200)
});
or
it ('GET should return a status of 200 OK', function () {
return frisby
.get('url-api')
.expect('status', 200)
});
Also have a look at the docs