diff --git a/lib/test.js b/lib/test.js index f6a0e6b2..f4013bc1 100644 --- a/lib/test.js +++ b/lib/test.js @@ -88,15 +88,16 @@ function Test(name_, opts_, cb_) { this._objectPrintDepth = 5; } - for (var prop in this) { - this[prop] = (function bind(self, val) { - if (typeof val === 'function') { + var self = this; + for (var prop in self) { + if (typeof self[prop] === 'function') { + self[prop] = (function bind(propName) { + var val = self[propName]; return function bound() { return val.apply(self, arguments); }; - } - return val; - }(this, this[prop])); + }(prop)); + } } }