Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Remove instanceof occurrence

John Firebaugh21dccc2488b7
diff --git a/lib/runnable.js b/lib/runnable.js
index 76a74f38..f5c27155 100644
--- a/lib/runnable.js
+++ b/lib/runnable.js
@@ -188,7 +188,7 @@ Runnable.prototype.run = function(fn){
if (this.async) {
try {
this.fn.call(ctx, function(err){
- if (err instanceof Error) return done(err);
+ if (Object.prototype.toString.call(err) === "[object Error]") return done(err);
if (null != err) return done(new Error('done() invoked with non-Error: ' + err));
done();
});