Skip to content

Commit

Permalink
Merge pull request #10 from hiddentao/globalModuleCache
Browse files Browse the repository at this point in the history
Look at global module cache rather than just main scripts immediate loads
  • Loading branch information
blakeembrey committed Oct 28, 2014
2 parents b4a91d0 + 0c4f026 commit 774d1b2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions co-mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ var coMocha = module.exports = function (mocha) {
*/
var findNodeJSMocha = function () {
var suffix = path.sep + path.join('', 'mocha', 'index.js');
var children = require.main && require.main.children || [];
var children = require.cache || {};

return children.filter(function (child) {
return child.id.slice(suffix.length * -1) === suffix;
return Object.keys(children).filter(function (child) {
return child.slice(suffix.length * -1) === suffix;
}).map(function (child) {
return child.exports;
return children[child].exports;
});
};

Expand Down

0 comments on commit 774d1b2

Please sign in to comment.