0.1.2 • Published 4 years ago

chai-retry v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

chai-retry

A chai plugin to retry assertions.

It has been a common problem with chai assertions that it fails due to the asynchronous behavior of an API/Web. Mocha somehow manage the problem with retries the whole function. But, what if chai itself be the smarter guy and retry its assertions on its own? This plugin will help you exactly achieve the same. This will reduce the falkiness in your test suite.

Install the plugin

npm i --save-dev chai-retry

Configuration

const chaiRetry = require('chai-retry')
chai.use(chaiRetry)

chai.config.retry = 20 // will retry same assertion for 20 times, defaults to 10
chai.config.interval = 5000 // the polling interval in ms between each retry, defaults to 2000 ms

Usage

Once the configuration is set, you can perform any native chai assertion. Each assertion will be retried for specified retry count in case assertion is failing. As soon as the assertion succeeds, it will break the chain and the send feedback. So, this plugin will retry the assertion when and only when the assertion fails.

Demo

demo

Tell me your issues

you can raise any issue here

Contribution

Pull requests are welcome.

If it works for you , give a Star!

- Copyright © 2020- Abhinaba Ghosh

0.1.2

4 years ago

0.1.1

4 years ago