Re-run flaky Mocha tests to flush out inconsistent results
npm install mocha-stress
Stress-test inconsistent parts of your Mocha test suite to identify and correct flaky tests.
mocha-stress requires node.js >= 4.
``shInstall the package from npm
$ npm install --save-dev mocha-stress
Usage
To run a specific spec a fixed number of iterations:
`js
it.stress(100, 'is failing sometimes for some reason??', function () {
expect(Math.random()).to.be.below(0.5)
})
`It can also be used on an entire
describe suite:`js
describe.stress(100, 'inconsistent', function () {
// ..
})
`This implies
.only()`.