infopark/screw-unit — pull request #1 by apepper (2013-06-11 14:56:51+00:00)
Title: Introducing run and waitFor for async testing

Asynchronous testing is done by specifying one or more `waitFor`/`run` functions inside an `it`.

```javascript
it("tests an asynchronous function", function() {
function asyncSum(lhs, rhs, result) {
window.setTimeout(function() {
result.sum = lhs + rhs;
}, 250);
}

var result = {};

run(function() {
asyncSum(2, 3, result);
});

waitFor({
description: "waiting for asyncSum to give a result timed out.",
run: function() {
return result.sum !== undefined;
},
timeout: 1500
});

/* An alternative short-hand waitFor function with default description and timeout (of 5000ms) would be to use:
waitFor(function() {
return result.sum !== undefined;
});
*/

run(function() {
assertThat(result.sum, 5);
});
});
```

Commits are mainly by @EleotleCram (see https://github.com/EleotleCram/screw-unit )