Mocha - retry after timeout

Viewed 227

I am using mocha with following flags: --timeout 450000 --retries 3.

Mocha retries whenever something goes wrong during test execution or if the assertion fails i.e. it respects the --retries 3 flag and retries for three (3) more times to see if the test pass before failing it.

But when the tests timeout, it doesn't respect the --retries 3 flag. Instead it simply fails the test with the following message:

Error: Timeout of 450000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
      at listOnTimeout (internal/timers.js:554:17)
      at processTimers (internal/timers.js:497:7)

How can I make mocha retry if the test has timed out? This is important because in my setup the tests can do timeout because they depend on network conditions.

0 Answers
Related