mocha-eventually
Retries a Mocha test until it works
Last updated 5 years ago by rstacruz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mocha-eventually 
SYNC missed versions from official npm registry.

mocha-eventually

Retries a test until it eventually works.

Status

eventually(callback(next()), [timeout], [interval]) -> Promise

callback is a function. If it's async, it should either consume the next() parameter, or return a promise.

If it doesn't work within timeout milliseconds, it's considered a failure.

If a test fails and timeout has not ellapsed yet, it will wait interval milliseconds and try again.

Returns a promise, which Mocha will happily consume.

var eventually = require('mocha-eventually')

it('eventually works', function () {
  return eventually(function (next) {
    assert(Math.random() > 0.9)
  }, 2000)
})

Thanks

mocha-eventually © 2015+, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors (list).

ricostacruz.com  ·  GitHub @rstacruz  ·  Twitter @rstacruz

Current Tags

  • 1.1.0                                ...           latest (5 years ago)

2 Versions

  • 1.1.0                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (0)
None
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |