Permalink
Browse files

Add a way to specify custom timeout when pausing a test

Sometimes you need more than the default timeout (250ms) to do
your stuff. This patch adds a new argument to the Test.pause
method that can be used to specify a custom timeout value.

  test.pause(500); // If after 500ms. test is still in paused
	                 // state--consider it a failure.
  • Loading branch information...
1 parent f150fb9 commit 5e4e3041d1e25619f64219a34037c9135c8280f7 @valueof committed May 16, 2012
Showing with 6 additions and 3 deletions.
  1. +3 −1 src/test.js
  2. +3 −2 test/test.js
View
4 src/test.js
@@ -97,7 +97,9 @@ Test.prototype = {
this.expected = num;
},
- pause: function () {
+ pause: function (timeout) {
+ if (timeout)
+ this.timeout = timeout;
this.status = PAUSED;
},
View
5 test/test.js
@@ -69,18 +69,19 @@ exports.testFailedTest = function (test) {
};
exports.testPausedTest = function (test) {
- test.expect(5);
+ test.expect(6);
var testcase = new Test({
name: "testPaused",
func: function (ts) {
test.ok(true);
- ts.pause();
+ ts.pause(100);
}
});
testcase.run();
test.equal(testcase.status, PAUSED);
+ test.equal(testcase.timeout, 100);
test.strictEqual(testcase.report.success, null);
testcase.resume();

0 comments on commit 5e4e304

Please sign in to comment.