Rostislav Shtanko
Rostislav Shtanko

Reputation: 724

Retries in mocha do not work

I'm trying to use retries in mocha. Here is my code:

'use strict';

const assert = require('chai').assert;

describe('retries', function() {
    it('should not be equal', function () {
        this.retries(10);
        assert.equal(1, 2);
    });
});

I'm expecting, that test would be retried 10 times, but it didn't. Version of mocha is 3.3.0

Upvotes: 1

Views: 2779

Answers (1)

Louis
Louis

Reputation: 151441

Mocha does in fact retry your code. However, Mocha does not show you each individual attempt. It only reports the final result as to whether the test passed at some point (after some number of tries), or failed (because all the tries failed). If you add console.log("something") to your test, you'll see it retries your test as you specified.

Upvotes: 4

Related Questions