From 594d263eaffebeb3539c403ac0a0227acacdaed7 Mon Sep 17 00:00:00 2001 From: Jean Ponchon Date: Fri, 16 May 2014 17:38:20 +0200 Subject: [PATCH] Undefined callback error in mocha.run() on browser Mocha.prototype.run(callback) provide an error status to the callback (0/1). But this value is not forwarded to the browser callback. mocha.run(function(err) { console.log(err); // Always undefined }) --- support/tail.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/support/tail.js b/support/tail.js index 018add8d0c..999d38da0f 100644 --- a/support/tail.js +++ b/support/tail.js @@ -135,12 +135,12 @@ mocha.run = function(fn){ if (query.grep) mocha.grep(query.grep); if (query.invert) mocha.invert(); - return Mocha.prototype.run.call(mocha, function(){ + return Mocha.prototype.run.call(mocha, function(err){ // The DOM Document is not available in Web Workers. if (global.document) { Mocha.utils.highlightTags('code'); } - if (fn) fn(); + if (fn) fn(err); }); };