Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

refactor

TJ Holowaychuka22fc7824378
diff --git a/lib/runnable.js b/lib/runnable.js
index f5c27155..79318cc3 100644
--- a/lib/runnable.js
+++ b/lib/runnable.js
@@ -17,6 +17,12 @@ var Date = global.Date
, clearTimeout = global.clearTimeout
, clearInterval = global.clearInterval;
+/**
+ * Object#toString().
+ */
+
+var toString = Object.prototype.toString;
+
/**
* Expose `Runnable`.
*/
@@ -188,7 +194,7 @@ Runnable.prototype.run = function(fn){
if (this.async) {
try {
this.fn.call(ctx, function(err){
- if (Object.prototype.toString.call(err) === "[object Error]") return done(err);
+ if (toString.call(err) === "[object Error]") return done(err);
if (null != err) return done(new Error('done() invoked with non-Error: ' + err));
done();
});