Skip to content

Commit

Permalink
log third-party reporter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgruber authored and danielstjules committed Mar 14, 2015
1 parent 8a60787 commit ca84810
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/mocha.js
Expand Up @@ -144,7 +144,11 @@ Mocha.prototype.reporter = function(reporter, reporterOptions){
reporter = reporter || 'spec';
var _reporter;
try { _reporter = require('./reporters/' + reporter); } catch (err) {}
if (!_reporter) try { _reporter = require(reporter); } catch (err) {}
if (!_reporter) try { _reporter = require(reporter); } catch (err) {
err.message.indexOf('Cannot find module') !== -1
? console.warn('"' + reporter + '" reporter not found')
: console.warn('"' + reporter + '" reporter blew up with error:\n' + err.stack);
}
if (!_reporter && reporter === 'teamcity')
console.warn('The Teamcity reporter was moved to a package named ' +
'mocha-teamcity-reporter ' +
Expand Down

0 comments on commit ca84810

Please sign in to comment.