Skip to content

Commit

Permalink
ES3/browser fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Sorin committed Aug 17, 2016
1 parent fec9198 commit 5a0c91a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ function Mocha(options) {

// files which were in require.cache
// by the moment of mocha instance creation
this._requireCache = this._getRequireCache();
this._requireCache = process.browser
? []
: this._getRequireCache();
}

/**
Expand Down Expand Up @@ -225,7 +227,10 @@ Mocha.prototype.loadFiles = function(fn) {
suite.emit('post-require', global, file, self);
});

this._flushRequireCache();
if (!process.browser) {
this._flushRequireCache();
}

fn && fn();
};

Expand Down Expand Up @@ -258,7 +263,7 @@ Mocha.prototype._growl = function(runner, reporter) {
* @api private
*/
Mocha.prototype._getRequireCache = function() {
return Object.keys(require.cache || {});
return Object.keys(require.cache);
};

/**
Expand Down

0 comments on commit 5a0c91a

Please sign in to comment.