waitsfor

0.0.6 • Public • Published

waitsfor

Wait for truth of a condition using promises

build

Usage (directly as a global)

var condition = false;
waitsFor(function() { return condition }).done(function() {
  doSomething();
})

waitsfor also integrates with promise libraries to extend their promise chains, just include the promiseAdaptor file that you want after waitsfor.js (only Q is supported currently).

var condition = false;
var promsie = Q.defer().promise;
promsie.waitFor(function() { return condition }).done(function() {
  doSomething()
})

Node

var waitsfor = require('waitsfor')
waitsfor.waitsFor(function() { .. }).then( ... )

Motivation

Jasmine v1 features a convention for async test cases using waitsFor and runs. This was removed in v2, making it difficult to write code that waits for a condition. In a 'black box' scenario where no event, callback or promise is available from the code in test, a solution to poll for a condition and provide familiar promises eases in upgrading tests to the new style.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.6
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.6
    0
  • 0.0.5
    1
  • 0.0.3
    0
  • 0.0.1
    1

Package Sidebar

Install

npm i waitsfor

Weekly Downloads

2

Version

0.0.6

License

c

Last publish

Collaborators

  • lincolnb