2

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?

Lin Du
  • 88,126
  • 95
  • 281
  • 483
Nikhil Shisode
  • 165
  • 1
  • 15
  • Possible duplicate of [Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout](https://stackoverflow.com/questions/49603939/async-callback-was-not-invoked-within-the-5000ms-timeout-specified-by-jest-setti) – Kraylog Nov 10 '19 at 10:53
  • in case you don't use unmocked timeouts, may you provide sample test that is failing? do your question's tags mean that tests always passes at Linux(say, at CI server)? – skyboyer Nov 10 '19 at 13:13
  • Provide the code you want to test. – Lin Du Dec 19 '19 at 06:20

0 Answers0