Skip to content

Instantly share code, notes, and snippets.

@trentm
Created December 5, 2011 20:11
Show Gist options
  • Save trentm/1435149 to your computer and use it in GitHub Desktop.
Save trentm/1435149 to your computer and use it in GitHub Desktop.
Index: /Users/trentm/src/node-tap/lib/tap-harness.js
index 5083aba..2d7120f 100644
--- a/lib/tap-harness.js
+++ b/lib/tap-harness.js
@@ -159,11 +165,13 @@ Harness.prototype.test = function test (name, conf, cb) {
if (isNaN(conf.timeout)) conf.timeout = 30000
var t = new this._Test(this, name, conf)
if (cb) {
- if (!isNaN(conf.timeout) && isFinite(conf.timeout)) {
- var timer = setTimeout(t.timeout.bind(t), conf.timeout)
- t.on("end", clearTimeout.bind(null, timer))
- }
//console.error("attaching cb to ready event")
+ t.on("ready", function () {
+ if (!isNaN(conf.timeout) && isFinite(conf.timeout)) {
+ var timer = setTimeout(this.timeout.bind(this), conf.timeout)
+ this.on("end", clearTimeout.bind(null, timer))
+ }
+ })
t.on("ready", cb.bind(t, t))
// proxy the child results to this object.
//t.on("result", function (res) {
@trentm
Copy link
Author

trentm commented Dec 7, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment