Unstable / flaky tests are tests which sometimes pass and sometimes fail, without any code change. Obviously, they slow down developments when developers have to rerun failed tests. However, the real problem is that you can’t completely trust these tests, they might fail for many different reasons and you don’t know if any of them will happen in production.
Some tools, such as Jest, enable developers to automatically retry flaky tests. This might be acceptable as a temporary solution, but it should eventually be fixed. The more flaky tests you add, the more chances there are for a bug to arrive in production.
This rule raises an issue when these functions are called with a value higher than 0: * jest.retry() *
this.retries() inside a Mocha test case
Make your test stable so that it passes on the first try, or remove it.
jest.retryTimes(3); // Noncompliant
describe('API.foo()', function() {
it('should return 5 when computing ...', function() {
doSomethingUnstable();
});
});