Skip to content

Conversation

@steph-lebl
Copy link

Fix for #53

These new features are used to improve mocha-concurrent-api-tests and provide a detail for flaky tests in the test report.
For more details see:
https://github.com/VilledeMontreal/mocha-concurrent-api-tests/blob/master/example/README.md#test-report-exemple-when-a-test-fails-or-does-not-succeed-on-the-first-time-flaky

/**

  • If a test fails, it will be retried until it succeeds or maxRetries is reached.
  • Useful if some tests have dependecies (ex: network) that fail from time to time.
  • @param {int} n
    */
    parallel.maxRetries(n)

/**

  • If a test hang and maxRetries > 0, the test will be retried after retryTimeoutInMiliseconds
  • retryTimeoutInMiliseconds does not alter the default timeout of Mocha.
  • Ex:
  • if a test hang forever and maxRetries=10, retryTimeoutInMiliseconds=1000 and
  • mocha timeout is 5 secondes, then the test will be retried 5 times because
  • retryTimeoutInMiliseconds but will stop as soon as Mocha timeout is readed.
  • @param {int} n
    */
    parallel.retryTimeoutInMiliseconds(n)

/**

  • getRetriedTestFailures allow to know what caused the test to be retried.
  • maxRetries avoid failling the suite because of some flaky tests but flaky
  • tests should not be retried silently.
  • getRetriedTestFailures can be used to include retried test failures in
  • a custom Mocha reporter.
  • For more details, see https://mochajs.org/api/tutorial-custom-reporter.html
    */
    parallel.getRetriedTestFailures()

@steph-lebl steph-lebl closed this by deleting the head repository Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant