I'm getting inconsistent results when every I run npm test
Sometimes all test pass and most of the time one or the other test fails due to this error:
Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.
at node_modules/jest-jasmine2/build/queue_runner.js:68:21
at Timeout.callback [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:678:19)
I have noticed when ever test files name is printed twice or thrice some test fails.
I'm using WSL to run the tests and I have configured jestjs
like this:
"scripts": {
"test": "jest --watchAll --verbose --coverage"
},
"jest": {
"testURL": "http://localhost/"
},
how should I configure jest so the tests run properly or fix this inconsistent behavior?