Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Fixed exports interface

Tj Holowaychukdbef53e33ac3
diff --git a/bin/mocha b/bin/mocha
index 05d589f8..bc1b68bc 100755
--- a/bin/mocha
+++ b/bin/mocha
@@ -79,9 +79,9 @@ if (!files.length) {
var pending = files.length;
files.forEach(function(file){
file = join(cwd, file);
- suite.emit('file', global, file);
- require(file);
- suite.emit('file end', global, file);
+ // suite.emit('file', global, file);
+ suite.emit('require', require(file), file);
+ // suite.emit('file end', global, file);
--pending || run(suite);
});
diff --git a/lib/interfaces/exports.js b/lib/interfaces/exports.js
index e0e9a583..ba1a913b 100644
--- a/lib/interfaces/exports.js
+++ b/lib/interfaces/exports.js
@@ -26,15 +26,7 @@ var Suite = require('../suite')
module.exports = function(suite){
var suites = [suite];
- suite.on('file', function(context, file){
- context.module = {};
- context.module.exports = {};
- });
-
- suite.on('file end', function(context, file){
- var obj = context.module.exports;
- visit(obj);
- });
+ suite.on('require', visit);
function visit(obj) {
var suite;