Skip to content

Commit

Permalink
Remove fail() override in Mocha
Browse files Browse the repository at this point in the history
I'm not sure what this was for, but at least with an async test function
it seems to be causing spurious "the string 'x' was thrown, throw an
Error :)" messages that hide the real error.
  • Loading branch information
dstillman committed Feb 7, 2018
1 parent 45ddf98 commit 4731b8f
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions test/content/runtests.js
Expand Up @@ -161,21 +161,6 @@ function Reporter(runner) {
});
}

// Monkey-patch Mocha to check instanceof Error using compartment-local
// Error object
Mocha.Runner.prototype.fail = function(test, err){
++this.failures;
test.state = 'failed';

if ('string' == typeof err) {
err = new Error('the string "' + err + '" was thrown, throw an Error :)');
} else if (!(err instanceof Components.utils.getGlobalForObject(err).Error)) {
err = new Error('the ' + Mocha.utils.type(err) + ' ' + Mocha.utils.stringify(err) + ' was thrown, throw an Error :)');
}

this.emit('fail', test, err);
};

// Setup Mocha
mocha.setup({
ui: "bdd",
Expand Down

0 comments on commit 4731b8f

Please sign in to comment.